I am trying to use a global macro that contains a reference to a loop (`var').
This is the original code:
Code:
levelsof country, local(levels) foreach l of local levels { foreach var of varlist y1 y2 y3 { eststo `var'_`l': reg `var' x1 if country== "`l'" } } foreach var of varlist y1 y2 y3 { local graphtitle : variable label `var' coefplot (`var'_Argentina \ `var'_Austria \ `var'_Belgium \ `var'_Brazil)
Code:
global countries "(`var'_Argentina \ `var'_Austria \ `var'_Belgium \ `var'_Brazil)"
Code:
levelsof country, local(levels) foreach l of local levels { foreach var of varlist y1 y2 y3 { eststo `var'_`l': reg `var' x1 if country== "`l'" } } foreach var of varlist y1 y2 y3 { local graphtitle : variable label `var' coefplot $countries
estimation result _Argentina not found
Thanks in advance,
Marc
0 Response to Global macro with `var'
Post a Comment