I run a regression in Stata with a Compustat dataset that contains
gvkey. I want to add firm and year fixed effects, so I type the following command:
regress DV IV i.fyear i.gvkey
But Stata returns the error r(103), which suggests “too many variables specified”. It turns out that the culprit is
I find two work-arounds:
(1) Use both
xtreg DV IV i.fyear, fe
areg DV IV i.fyear, absorb(gvkey)
xtreg is the Stata command for fixed-, between-, and random-effects linear models, and
areg is the Stata command for linear regression with a large dummy-variable set.
In my example, I find that both commands returns exactly same results.