Hi guys,
I am having problems with providing a reproducible sample for my dataset.
I have a variable 'Firmsize' which groups observations based on the size of a firm. Now what i want is to get a specific number of random observations from each Firmsize-group. This does work (see the syntaxes below). But every time i run the syntaxes anew, i get different sample-observations, even though i have set the seed in the beginning of the sequence. I have tried a few different possibilities, like setting the seed before every sample-syntax, but these didn't work either. Have you guys got a suggestion on how to get a reproducible sample-dataset for this block of code?
Code:
sort Firmsize
set seed 6500
sample 395 if Firmsize==1, count by(ICMW)
sample 348 if Firmsize==2, count by(ICMW)
sample 295 if Firmsize==3, count by(ICMW)
sample 257 if Firmsize==4, count by(ICMW)
sample 212 if Firmsize==5, count by(ICMW)
sample 185 if Firmsize==6, count by(ICMW)
sample 150 if Firmsize==7, count by(ICMW)
sample 134 if Firmsize==8, count by(ICMW)
sample 103 if Firmsize==9, count by(ICMW)
sample 69 if Firmsize==10, count by(ICMW)
Thanks in advance!
Greetings,
Max
0 Response to Getting reproducible sample-observations
Post a Comment