Statalist The Stata Listserver


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

Re: st: randomly selecting subjects from clusters


From   Jeph Herrin <[email protected]>
To   [email protected]
Subject   Re: st: randomly selecting subjects from clusters
Date   Tue, 03 Oct 2006 14:00:04 -0400

The FAQ almost answers the question, but not quite: to get
one random individual per household (as opposed to a random
sample of households), try:

 set seed 12345678
 gen random=uniform()
 bys household (random): gen byte mysample=_n==1

Then -mysample- will be one randomly selected individual
per household.

hth,
Jeph



n j cox wrote:
The Statalist FAQ advises, inter alia, consideration of
the existing FAQs. In this case,

How can I sample clusters, not individuals?
http://www.stata.com/support/faqs/data/sampleby.html

Nick
[email protected]

Mariano Sana

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?

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