Hi Statalisters,
I am trying to get a random sample of 40 subjects from a dataset of a
few hundred subject. This is what I did:
.set seed 12345
.gen random = uniform()
.sort random, stable
.drop if _n>40
For various reasons, it might be that some subjects in the sample are
not suitable for selection and I want to exclude them from the sample
and from the overall dataset.
So I selected another sample, however, when I did that other subjects
were selected as well.
.drop if id == 890800 //subject that wasn't suitable dropped
.set seed 12345
.gen random = uniform()
.sort random, stable
.drop if _n>40
What I want is to keep the original 39 subjects as in the old sample
in and just replace the subject that wasn't suitable. Any suggestions
would be appreciated.
Many thanks.
Raoul
--
-------------------------------------------------------
Raoul C. Reulen
Cancer Research UK Training Fellow
*
* 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/