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: st: Loop question II


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Loop question II
Date   Wed, 9 Feb 2011 09:00:27 +0000

You can specify only one local macro name to -foreach-, so your loop
looks illegal either way.

Nick

On Wed, Feb 9, 2011 at 8:44 AM, Alberto R Osella
<arosella@irccsdebellis.it> wrote:
> Thank you for your answer. ERally in the last line there are two different
> local.
> I've used local as -listtype- because they are all local previously defined
> as written in the post.
>
> Il 09/02/2011 09:00, Tirthankar Chakravarty ha scritto:
>>
>> You have repeated "All_Factors_3R_SES" on the last line. Plus, if
>> these are all variables, as your usage suggests, use "varlist" rather
>> than "local" as you -listtype-.
>>
>
>> On Tue, Feb 8, 2011 at 11:43 PM, Alberto R Osella
>> <arosella@irccsdebellis.it>  wrote:
>>>
>>> I'm trying to run this loop:
>>> foreach lr of local  F1_5R_SES F1_5R_EST F2_5R_SES F2_5R_EST F3_5R_SES
>>> F3_5R_EST F4_5R_SES F4_5R_EST F1_5B_SES F1_5B_EST F2_5B_SES F2_5B_EST
>>> F3_5B_SES F3_5B_EST ///
>>>                                F4_5B_SES F4_5B_EST F1_4R_SES F1_4R_EST
>>> F2_4R_SES F2_4R_EST F3_4R_SES F3_4R_EST F4_4R_SES F4_4R_EST F1_4B_SES
>>> F1_4B_EST F2_4B_SES F2_4B_EST  ///
>>>                                F3_4B_SES F3_4B_EST F4_4B_SES F4_4B_EST
>>> F1_3R_SES F1_3R_EST F2_3R_SES F2_3R_EST F3_3R_SES F3_3R_EST F4_3R_SES
>>> F4_3R_EST F1_3B_SES F1_3B_EST  ///
>>>                                F2_3B_SES F2_3B_EST F3_3B_SES F3_3B_EST
>>> F4_3B_SES F4_3B_EST All_Factors_5R_SES All_Factors_5R_EST
>>> All_Factors_5B_SES
>>> All_Factors_5B_EST                     ///
>>>                               All_Factors_4R_SES All_Factors_4R_EST
>>> All_Factors_4B_SES All_Factors_4B_EST All_Factors_3R_SES
>>> All_Factors_3R_EST
>>> All_Factors_3R_SES All_Factors_3B_EST   {
>>>                     logistic caso_ctrol0 `lr'
>>>                     }
>>> where any of the name of local are local previously defined.
>>> Stata tells me:
>>>  3.                                          }
>>> { required
>>> r(100);
>>>
>>> end of do-file
>>> I'm using Stata11.1 on Windows 7.
>>> Can anyone help me?
>>> Thank you
>>>

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