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
BootstrapHi everyone, I need some help with understanding why STATA doesn't let me use the command: bootstra…
How to interpret the result of the "Total Factor Productivity of Manufacturing Firms" based on Levinsohn and Petrin (2003) approach?I intend to measure the TFP of manufacturing firms for 23 firms through Cobb - Douglas Production Fu…
Advices on how to learn systematically how to work with panelHi everyone, I have very elementary skills in econometrics and until now I've only worked with cros…
Saving WTP estimates to conduct Poe TestDear all I have run a clogit model and have estimated wtp via wtp, krisnky command. I now want to s…
Formatting and managing dates, from String to MMYYYY formatDear All, I am a new user in Stata. I am having a basic question and would kindly ask for your help.…
Subscribe to:
Post Comments (Atom)
0 Response to using macro variables in loop
Post a Comment