Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: draw a sample from variables and incidence rates


From   Jeph Herrin <junk@spandrel.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: draw a sample from variables and incidence rates
Date   Wed, 18 Mar 2009 08:35:02 -0400


moleps islon wrote:
Dear statalisters,
2 questions:
-Is there an easy way to draw 40 random patients from a sample of 450
and generate a dummy variable containg 0 "not drawn" 1"drawn". E.g a
command like : draw variable 40, gen(dummy)

Probably better to put two such disparate questions in two different
postings. I'll address the first:

 gen drawn=uniform()
 sort drawn
 replace drawn=_n<=40


hth,
Jeph
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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