Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: AW: st: RE: loop over macros


From   Eric Booth <[email protected]>
To   "<[email protected]>" <[email protected]>
Subject   Re: AW: st: RE: loop over macros
Date   Mon, 23 Aug 2010 13:25:19 +0000

<>
Yes, thanks Martin, I should have mentioned that it's from SSC.
((By "option", I mean a possible way for Jorg to run a combination of his models using looping - not that it is a native "option" within Stata))
On Aug 23, 2010, at 8:19 AM, Martin Weiss wrote:

> 
> <> 
> 
> But -ssc d tuples- is not exactly an "option", is it? It is a user-written
> contribution by NJC.
> 
> 
> 
> 
> HTH
> Martin
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: [email protected]
> [mailto:[email protected]] Im Auftrag von Eric Booth
> Gesendet: Montag, 23. August 2010 15:16
> An: <[email protected]>
> Betreff: Re: st: RE: loop over macros
> 
> <>
> 
> -tuples- is another useful option -- though it gives you more combinations
> of your models than you ask for:
> 
> *******!
> tuples  "migdummy1 migdummy2"  "fr49 fr48"  "schulart_e1 schulart_e2"
> forval i = 1/`ntuples' {
> di as inp  "MODEL `i':  `tuple`i''"
> mlogit  munomi7  `tuple`i''
> estimates save m`i', replace
> }
> *******!
> 
> ~ Eric
> __
> Eric A. Booth
> Public Policy Research Institute
> Texas A&M University
> [email protected]
> Office: +979.845.6754
> 
> 
> On Aug 23, 2010, at 8:03 AM, Nick Cox wrote:
> 
>> Try 
>> 
>> forval i = 1/3 { 
>> 	mlogit munomi7 `model_`i'' 
>> 	estimates save model_`i' 
>> } 
>> 
>> Nick 
>> [email protected] 
>> 
>> Jörg Eulenberger
>> 
>> i want to loop over local macros, not over the items in the locals. I 
>> want to estimate 3 multinominal logit models. One with the variables in 
>> local macro "model_1" as independent variables in the model, one with 
>> the  variables in local macro "model_2" .....  and so on.  Only three 
>> Modells.
>> 
>> local set1_mig "migdummy1 migdummy2"
>> local set2_sex "fr49 fr48"
>> local set3_educ " schulart_e1 schulart_e2"
>> 
>> 
>> local model_1 "`set1_mig'"
>> local model_2 "`model_1' `set2_sex'"
>> local model_3 "`model_2' `set3_educ'"
>> 
>> foreach macro of varlist "`model_1'" "`model_2'" "`model_3'" {
>> mlogit  munomi7 `macro'
>> estimates save mlogit`macro'
>> }
>> I cant find the right syntax for the foreach command.
>> 
>> *
>> *   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/
> 
> 
> *
> *   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index