Dear Stata users,
Sorry for posting several posts related to one issue. However, I can not properly figure out the solution. What I need is the following. I need to run the pooled ols model below within the period 1995-2015. Then, I need to store the values of fixed effect (firmID – gvkey1) within each year using rolling 3-year window. For instance, to obtain the firm-specific “gvkey1” coefficient for year 2005, I run equation below pooling firm-year observations for 2005, 2004 and 2003. Here is my regression within the loop, but I don’t know how to store the coefficients.
I tried “matrix gvkey_coeff=e(b)'” but it does not work within the loop. Please, advise me this issue.
Best regards,
Alberto
Sorry for posting several posts related to one issue. However, I can not properly figure out the solution. What I need is the following. I need to run the pooled ols model below within the period 1995-2015. Then, I need to store the values of fixed effect (firmID – gvkey1) within each year using rolling 3-year window. For instance, to obtain the firm-specific “gvkey1” coefficient for year 2005, I run equation below pooling firm-year observations for 2005, 2004 and 2003. Here is my regression within the loop, but I don’t know how to store the coefficients.
Code:
sum fyear scalar minyr=r(min) scalar maxyr=r(max) local m=minyr local n=maxyr forvalues i=`m'(1)`n'{ qui reg bm_w i.gvkey1 D b1D b2D b3D b4D b5D b6D cum_ret_w b1cum_ret_w b2cum_ret_w b3cum_ret_w b4cum_ret_w b5cum_ret_w b6cum_ret_w DR_w b1DR_w b2DR_w b3DR_w b4DR_w b5DR_w b6DR_w i.fyear if inrange(fyear, fyear==`i-1', fyear==`i+1'), vce(cluster gvkey1) di `i' }
Best regards,
Alberto
Comment