Statalist The Stata Listserver


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

st: RE: select a random obs from dataset


From   "Alex Ogan" <[email protected]>
To   <[email protected]>
Subject   st: RE: select a random obs from dataset
Date   Wed, 17 May 2006 10:03:28 -0400

This will select one person randomly per household:

gen randomvar = uniform()
bysort householdid (randomvar): gen selectionflag = _n==1 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Akihito
Tokuhara
Sent: Wednesday, May 17, 2006 9:55 AM
To: [email protected]
Subject: st: select a random obs from dataset

Dear all,

My colleague wants to know how to select a random obs with some
conditions 
from her dataset.
She wants to select one person randomly per household, but also with 
condition that there is
no repetition of household (no household should appear twice in the
outcome, 
although the
person is different).

I don't know the method and I don't know if this can be done by Stata or

not. If there is a way, or some suggestions, I would appreciate very
much. 
Many thanks in advance.

Akihito

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/

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


This message is intended solely for the designated recipient(s). It may contain confidential or proprietary information and may be subject to confidentiality protections. If you are not a designated recipient, you may not review, copy, or distribute this message. If you receive this in error, please notify the sender by reply e-mail and delete this message. 

Arrowstreet Capital, L.P. is an Equal Opportunity Employer. 



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