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]

st: Draw a random sample of my data...

Subject   st: Draw a random sample of my data...
Date   Thu, 27 Sep 2012 16:19:35 +0200 (CEST)

Dear friends, I will code a subset of my data. I used the "sample"
command..However, I would like to fix my random sample, so that I can
generate the same sample again..For this I used the "set seed" command.
However, if I rerun the dofile I get different samples in my random
sample. Here is my dofile:

use all_data8;
sort countryID year;

by firmID, sort: gen firms = _n;
keep if firms==1;

by countryID, sort: egen countryfirms = total(firms);

keep if countryID==244;

set seed 260581;

sample 63;

save usfirms_1, replace;

Is there a bug in stata, or what is wrong? Please help.
Mehmet Altun...
*   For searches and help try:

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