Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: proportional random sampling


From   Cameron McIntosh <[email protected]>
To   STATA LIST <[email protected]>
Subject   RE: st: proportional random sampling
Date   Mon, 24 Oct 2011 22:51:27 -0400

Steve,
I think that if you described the motivation for this exercise, it might help elicit advice -- perhaps some that even suggests an alternative way of looking at your problem, whatever that may be. :)
Thanks,
Cam

----------------------------------------
> From: [email protected]
> To: [email protected]
> Date: Mon, 24 Oct 2011 17:15:20 -0600
> Subject: st: proportional random sampling
>
> Dear Statalisters,
>
> I have a small dataset (n=44) from which I want to draw a random sample of records. The distribution of these records across my variable of interest in approximately 2:1. What I wish to do is to create a random sample of records of size n that retains the proportional distribution across my variable of interest.
>
> Assuming a random sample where n=12, I wrote the following code:
>
> sort ecs
> by ecs: sample 8,count
> sample 50 if ecs==1
>
> ------
> Although how I coded it certainly works, what I am wondering if there is a more elegant means of coding to achieve a similar result?
>
>
> Thanks,
> Steve
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
 		 	   		  
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index