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
How can I copy the entire Stata code *.do I'm running in an excel fileHi, I am running multiple simulations per day and I would like to get all necessary information enc…
Minimum or maximum from a set contained in global macroHi, I would like to create a local macro that would contain only the maximum value of a set contain…
Availability of PDF format for graph exportDear All, Stata's electronic help files for graph export mention availability of different file for…
Reporting format for Stata's own commandsDear All, I've noticed just now that some of Stata's own commands report the output diagnostics usi…
inverse order of global macro listHI, I would like to inverse the order of a global macro list: Code: global M_per 6 12 24 36 72 12…
Subscribe to:
Post Comments (Atom)
0 Response to Getting reproducible sample-observations
Post a Comment