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]

st: simulataneous foreach loops


From   "Lim, Raymond" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: simulataneous foreach loops
Date   Fri, 12 Nov 2010 14:08:35 -0500

Hello Statalisters,
Is it possible to have two foreach loops running simultaneously? For example, I'm creating simulated teams of particularly sizes. I have team 102 to have 3 members, team 108 to have 5 members, team 202 to have 3 members, etc. The team numbers do NOT have a particular pattern. If it did I would use the loop below. Hence, I need to somehow index by (102, 3), (108, 5), (202,3), etc.

local tt=100
qui foreach NN of numlist 3 5 3 4 {
	bsample `NN'
	local tt=`tt'+1
	replace team=`tt'
	save simteam_`tt'.dta, replace
	restore
	preserve 
	}

Thanks!
-Raymond

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