Regarding the code I used verbose to check whether it works or not. You newer version is correct but still it saves (at least in my original dataset) only the first year for the first company.
Probably there is something that I do not do right.
Due to that i went towards a different direction to acquire results. Given that i use exret as my dependent variable,
I generated a variable to populate in order to restrict the results and asking for at least 11 obs per regression.
Code:
*create a variable measuring obs egen n_obs = count(exret), by (gvkey fyear)
Code:
statsby _b, basepop(n_obs>10) by(gvkey fyear) /// saving(C:\beta results.dta, replace) : reg exret rmrf
Leave a comment: