
From  "Michael Blasnik" <michael.blasnik@verizon.net> 
To  <statalist@hsphsun2.harvard.edu> 
Subject  Re: st: Sample command question 
Date  Tue, 31 Oct 2006 09:17:16 0500 
... Woops, my code below doesn't bother to save the dataset... the following 2 lines should be changed:
should beif `x'==1910 & `i'==1 save mysample else append using mysample
... Why not just create one big dataset and then pull it apart at the end:forval x =1910/2000 { local i=1 while `i' <=10 { use `x' sample 5, countgen dataset=`x' gen samplenum=`i' if `x'==1910 & `i'==1 save mysample else append using mysample * delete this line> save sample`x'`i', replace* now you have mysample with vars dataset, samplenum, and the variable of interest. You could save pieces however you want using another loop...local i= `i' +1 } }
* * 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–2014 StataCorp LP  Terms of use  Privacy  Contact us  What's new  Site index 