Statalist


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

Re: st: looping over local macros with multiple items


From   Jeph Herrin <[email protected]>
To   [email protected]
Subject   Re: st: looping over local macros with multiple items
Date   Wed, 01 Apr 2009 14:32:09 -0400


Here's your problem:

Eric A. Booth wrote:

foreach n in `reporttype' `populationtype' `sessiontype'  {
outsheet using "`sf'test/`reporttype'_`populationtype'_`sessiontype'.csv", replace comma
}


I think you want:

foreach R in "`reporttype'" {
	foreach P in "`populationtype'" {
		foreach S in "`sessiontype'" {
			outsheet using "`sf'test/`R'_`P'_`S'.csv", ///
			replace comma
		}
	}
}


hth,
Jeph

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index