Try references of the form ${M_`i'}
The braces spell out, much as in elementary algebra, that you want the
local to be evaluated first. Otherwise Stata interprets this incorrectly
as far as you are concerned.
This is covered in the manuals, although a copy is not to hand as I
write.
Nick
[email protected]
Leila Ben Aoun
I have a problem because I have many variables to put in my regression
and with an excel file I have managed to prepare all the combination I
want to put in my logistic regression. I named all my "X" in global
macros such as M_1 M_2 .. M_150
global M_149 "level_0 level_1 level_2 level_3 skill_50pct
marche_national emp20_49 emp50_99
emp100etplus nace17_1 nace17_2 nace17_3 "
global M_149 "scale_ICT_internet int_emp07 skill_50pct
marche_national emp20_49 emp50_99
emp100etplus nace17_1 nace17_2 nace17_3 "
global M_150 "scale_ICT_internet int_emp07_d skill_50pct
marche_national size size2 nace17_1 nace17_2 nace17_3 "
but then :
local i = 1
while `i'<177 {
logit Y $M_`i'
estimates store logit_M_`i' , title(M_`i')
local i = `i'+1
}
it doesn't work ! How can I deal with this? The problem is $M_1 in my
loop is only recognized as 1 but if I put $M_1 it works. But I don't
to copy paste at least 150 times !
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/