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

st: foreach-loop


From   "Hans J. Baumgartner" <[email protected]>
To   [email protected]
Subject   st: foreach-loop
Date   Mon, 10 Jan 2005 12:12:35 +0100

Dear statalist,

within a foreach-loop I would like to add loop-specific routines. I.e.:

foreach x in one two {
	some fancy commands
	if `x’=="one" {
		do this
	}
	if `x’=="two" {
		do that
	}
	some other fancy commands
}

Something is wrong but I cannot find out what.

Any help on this?

Cheers
Hans

--
Hans J. Baumgartner DIW Berlin
German Institute for Economic Research
Dept. Public Economics
Königin-Luise-Str. 5; 14195 Berlin; Germany
Tel.: +49/30/89789-307
Fax.: +49/30/89789-114
http://www.diw.de
http://www.hansbaumgartner.de


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