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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: problem with macro in a loop |

Date |
Wed, 10 Jun 2009 08:49:19 +0100 |

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 n.j.cox@durham.ac.uk 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/

**References**:**st: problem with macro in a loop***From:*Leila Ben Aoun <leilabenaoun@gmail.com>

- Prev by Date:
**Re: st: problem with macro in a loop** - Next by Date:
**Re: st: problem with macro in a loop** - Previous by thread:
**Re: st: problem with macro in a loop** - Index(es):

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