Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72786

Looping over a lagged variable with macro

$
0
0
Dear all,

I would like to run a regression testing different lag structures. In order to do so, since I have numerous models I'd like to test, I am trying to use macro but with scarce results.

More in detail (code below), I would like to regress my dependent variables strin_N and strin_M different lags of ks_C. In addition, since i need to run a lot of regression, I'd like to specify my explanatory variables using a global macro (in the example below Xforeign_KS). I tried the following command but it does not work. Stata does use the correct lags. Do you have any idea about why this is happening?

Thanks,
Enrico


forvalues i=0(1)2 {

global Xforeign_KS ks_A ks_B l`i'.ks_C

xtnbreg y strin_N $Xforeign_KS $Xcontrol i.year
outreg2 using modelN_lag`i'.doc, append ctitle(N.B. BVGR ) addtext(M)
xtnbreg y strin_M $Xforeign_KS $Xcontrol i.year
outreg2 using modelM_lag`i'.doc, append ctitle(N.B. BVGR - GREY) addtext(N)

}
*

Viewing all articles
Browse latest Browse all 72786

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>