Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: foreach and globals and {.}


From   "David Harrison" <david.harrison@icnarc.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: foreach and globals and {.}
Date   Mon, 11 Apr 2005 13:03:25 +0100

Another alternative way around the problem would be...

foreach x in `="${out_`year'}"' {
...

Personally I still prefer the -foreach x of global g-, which also runs quicker than -foreach x in $g-.

David

-----Original Message-----
From: Michael Blasnik [mailto:michael.blasnik@verizon.net]
Sent: 11 April 2005 12:47
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: foreach and globals and {.}


woops, I forgot about that requirement.  You can also put the global into a 
local before using it (which may be helpful in other situations):

local outyear ${out_`year'}
foreach x in `outyear' {
...

Michael Blasnik


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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