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: RE: Sampling problem
From
Joe Canner <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: RE: Sampling problem
Date
Wed, 26 Mar 2014 19:12:28 +0000
Daniela,
I don't see any way to speed up the process of taking the 100 samples, but I would suggest not waiting until afterwards to merge together the 100 samples.
Instead...
clear
set obs 10000
gen r=runiform()
save random, replace
forvalues x=1/100 {
use random, clear
bsample 379
gen n_sample=`x'
capture append using sample
save sample, replace
}
Incidentally, I did this on my PC and it only took a few seconds. If you are still having performance problems, please let us know which part of the process seems to be causing the problem.
Regards,
Joe Canner
Johns Hopkins University School of Medicine
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Daniela Albers
Sent: Wednesday, March 26, 2014 2:34 PM
To: [email protected]
Subject: st: Sampling problem
Hello all,
I am kind of new in stata, so hope someone can help me.
I have a data with 10.000 numbers generate with runiform() command. And I need to generate 100 samples (n=379) of the data (with replacement) and save this 100 samples (of 379 numbers in them) in a new data so that afterwords I can work with it.
I have been using:
preserve
bsample 379
saving the new sample
restore
(to do afterwards a merge of the 100 new datas)
But it seems it takes for ever but I hope there is an easier way to it.
Can someone help me
Thanks,
DANIELA
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/