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: Sampling question


From   Steve Samuels <[email protected]>
To   [email protected]
Subject   Re: st: Sampling question
Date   Sun, 25 Nov 2012 16:35:27 -0600

Oops,  I changed the example code but not the description.  Sorry.
Wendy:

I suggest that you use  Ben Jann's -gsample- command, from SSC.

The following example draws observations from 3 cateogries of rep78.
Adapt to your own needs. You need the -preserve- and -restore- commands,
because -gsample- keeps only the sampled observations.


Steve

********************************
sysuse auto, clear
preserve
gsample 10 if rep78==3, wor
tempfile t3
save `t3', replace

restore
preserve
gsample 5 if rep78==4, wor
tempfile t4
save `t4', replace

restore
preserve
gsample 3 if rep78==5, wor
append using `t3'
append using `t4'

tab rep78
save autosamp, replace
******************************


On Nov 25, 2012, at 3:51 PM, Wendy Alfaro wrote:

Dear Steve:

The answer is b.

Thank you in advance,

Wendy

On Sun, Nov 25, 2012 at 3:27 PM, Steve Samuels <[email protected]> wrote:



-- 
Wendy Alfaro Chaves
Consultora e investigadora
Agricultura, ambiente y alimentos
T: (506) 2494-3647
Correo-e: [email protected]
Skype: wendy07
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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