Statalist The Stata Listserver


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

Re: st: randomly select individual within strata


From   "Ada C. Chen" <[email protected]>
To   [email protected]
Subject   Re: st: randomly select individual within strata
Date   Tue, 10 Apr 2007 09:26:05 -0400

Thanks!
Will it be the same by the following syntax?

sort hhid
by hhid:sample 1, count


A. C. Chen


2007/4/10, n j cox <[email protected]>:
set seed 12345
gen random = uniform()
bysort hhid (random) : gen byte select = _n == 1

Ada C. Chen

Could anyone suggest me how to use STATA to randomly select one person
within a household? (says, there may be one to many persons within the
same household) I have a dataset of individuals and each has a
household ID.

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index