Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: problem with macro in a loop


From   Leila Ben Aoun <[email protected]>
To   [email protected]
Subject   st: problem with macro in a loop
Date   Wed, 10 Jun 2009 09:20:02 +0200

Hi,

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 !
Thanks for your help

-- 
Leila
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index