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
Related Posts with Getting reproducible sample-observations
identical marginal effects after xtpoisson with fixed-effectsI am trying to estimate the impact of a program introduced in the US in 2007 on the yearly number of…
Question about conformability: multiple imputation for measurement errorHi, I am trying to run a multiple imputation to correct for measurement error. Using "Int J Epidemi…
Not sorted error when trying to generate new lagged variablesHello, I am working on a project where I want to study how inheritances affect labour supply of rec…
Arellano & BondHi there, I am looking for some advice on using the xtabond command. In an effort to study the rel…
Bootstrap standard errors for a two step model and multiply imputed dataDear all, I am trying to account for sample selection into the selection of female and male wealth.…
Subscribe to:
Post Comments (Atom)
0 Response to Getting reproducible sample-observations
Post a Comment