From | Nick Winter <[email protected]> |
To | [email protected] |
Subject | Re: st: re: Sample with weights |
Date | Mon, 03 Oct 2005 09:53:43 -0400 |
This is simple, produces a sample of exactly the desired size,________________________________________________________
and I believe fulfills the condition of the probability of selection
being proportional to size .
*Assume "Size" is the company size variable, and M is the desired sample size
gen ppsorder = uniform() * Size
sort ppsorder
keep if _n <= M
drop ppsorder
Yes, sorting the file is a bit clumsy, but this is presumably a one time thing,
not something appearing inside a loop.
Regards,
=-=-=-=-=-=-=-=-=-=-=-=-=
Mike Lacy
Fort Collins CO USA
(970) 491-6721 office
© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |