Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

Re: st: Sampling question

From   Steve Samuels <>
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.

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.


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

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

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,


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

Wendy Alfaro Chaves
Consultora e investigadora
Agricultura, ambiente y alimentos
T: (506) 2494-3647
Skype: wendy07
*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index