Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: random sample


From   "Marcella Sapun" <msapun@jhu.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: random sample
Date   Thu, 26 Oct 2006 16:00:00 -0400

Hi Nick:
I just saw your email in my "full" inbox. This is great.
Thank you Nick and all of you for the helpful responses. I really
appreciated!
Marcella


>>> n j cox <n.j.cox@durham.ac.uk> 10/26/2006 11:10 AM >>>
You can put an -if uniform() < 0.1- condition on (e.g.)
a -use- statement. This samples records (observations).

As, by chance, this should yield a bit less than 10%
about half the time, some people wanting exactly 10%
would increase that fraction and then deal with surplus observations
once they had been read in.

See

http://www.stata.com/support/faqs/stat/sampling.html 

for more general discussion.

Nick
n.j.cox@durham.ac.uk 

Marcella Sapun

I want to read randomly 10% of a data set that contains about 1
million
records and 100 variables. How do I do that in stata?
*
*   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/
*
*   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