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" <[email protected]>
To   <[email protected]>
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:[email protected]]
Sent: 11 April 2005 12:47
To: [email protected]
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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index