----- Original Message -----
> I would like to select a random sample of 100 records. Not a random
> sample of a # percentage of the data in memory.
> So I do the following commands on a database that has 31638 records.
>
> ----------------------------
> . count
> 31638
>
> . sort CLAIMNBR
>
> . set seed 123456789
>
> . sample .316
> (31538 observations deleted)
>
> . count
> 100 /*I have 100 records because I know sample .316 would give me
> 100 records*/
> --------------------------------
>
> My first question: Is there a better way to do this?
>
sample 100, count
or if you want to keep all the data you can use swor
swor 100, gen(var1) keep
There is also a FAQ on sampling at:
http://www.stata.com/support/faqs/stat/sampling.html
Scott
*
* 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/