Dear all,
I am writing to ask for help in using macro variables in loops.
My code is something as follows. The reason I define a global ind_var is that I want to use different sets of ind_var so that I can just uncomment one of them and comment the rest to reuse the program.
However it does not seem to work - stata seems to ignore `type' in the regression.
Anyone know how to get this to work? or is it not possible to use macro variables in loop? Any advice or comment is highly appreciated.
global controls control1 control2 control3
global ind_var iv1`type' iv2`type' iv3`type' iv4`type'
*global ind_var iv1`type' iv2`type' iv3`type'
*global ind_var iv1`type' iv2`type' iv5`type'
*global ind_var iv1`type' iv2`type' iv6`type'
foreach type in type1 type2 type3 type4{
reg dv $ind_var $controls, fe
}
Related Posts with using macro variables in loop
failing to rename a variable by its labelDear all, I am interested in renaming several variables by its label (see an example below), howeve…
Testing for serial correlation between the interest rate and its lagsHello everyone, When including the interest rate into my time series model against the exchange rat…
Robustness checks - post regression graphhey stata friends and family, After I use rreg / mmregress / mregress, I want to create a scatter pl…
Plotting Groups of Fixed Effects Coefficients, By Group, By YearHello all, I realize my title might be a little dizzying, but I wasn't sure how else to phrase it. …
Why do I get different results for fe and gmm2s estimation using (xt)ivreg2?Dear Statalisters, I am trying to analyze the relationship between corruption and the distribution …
Subscribe to:
Post Comments (Atom)
0 Response to using macro variables in loop
Post a Comment