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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

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

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

Date |
Wed, 10 Jun 2009 09:31:08 +0200 |

<> Try ************* sysuse auto, clear glo M_1 "weight trunk tu" glo M_2 "tr disp" forv i=1/2{ logit for \$M_`i' } ************* and http://www.stata.com/support/faqs/lang/backslash.html HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Leila Ben Aoun Gesendet: Mittwoch, 10. Juni 2009 09:20 An: statalist@hsphsun2.harvard.edu Betreff: st: problem with macro in a loop 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/ * * 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:
**st: problem with macro in a loop** - Next by Date:
**Re: st: problem with macro in a loop** - Previous by thread:
**st: problem with macro in a loop** - Next 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 |