Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: simulataneous foreach loops

From   "Lim, Raymond" <>
To   "" <>
Subject   Re: st: simulataneous foreach loops
Date   Fri, 12 Nov 2010 14:45:36 -0500

I preserve before the loop in my actual code. The loop right now creates team 101 with 3 members, team 102 with 5 members, team 103 with 3 members, etc. Yes, there's a one-to-one mapping from tt to NN. I basically need two loop indices to change simultaneously. For example, first round (i=103, j=3), second round (i=139, j=5), third round (i=230, j=3). Of course, the real thing is a couple hundred pairs. 


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

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index