Statalist The Stata Listserver


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

Re: st: randomly selecting subjects from clusters


From   Antoine Terracol <[email protected]>
To   [email protected]
Subject   Re: st: randomly selecting subjects from clusters
Date   Tue, 03 Oct 2006 19:29:05 +0200

Mariano,

gen rnd=uniform()
bysort clusterID (rnd) : keep if _n==1

Antoine

le 03/10/2006 19:22, Mariano Sana a ecrit :

I have a data set where each record is an individual in a household. I have
all members of each household. How do I make a dataset that has only one
randomly selected member from each household?

(I know this is statistically incorrect if I were trying to get around the
problem of lack of independence among observations within clusters, but
that's not my goal, so please ignore the statistical implications of this).

I know how to generate a random variable, but I can't figure out how to
proceed after that. Thanks!

Mariano

*
*   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