I would like to obtain a nationally representative sample from a (non representative) survey data set thereby using every individual from the given survey data set. To do so I am creating a 100% random sample with the corresponding weights by using gsample 100 [aw=weight], percent. I am not expanding the data by using the weights first and then drawing a random sample with other commands (e.g. sample) since the data set that I start with is already quite big. The problem is that I am not getting the same sample every time I draw the sample. I tried to set the seed at various positions, at the beginning of the do-file or right before the gsample command. I also tried to sort the data according to a unique identifier right before drawing the sample and also setting the seed right before that. But nothing has helped to have the same random sample when I draw the sample again and again. Any help would be appreciated. I cannot post my code before using gsample command since it is quite long, but some commands involve sorting the data.
Related Posts with Set Seed Random Sample
“psmatch2” and “pstest”: different results in version 14 and 17Hello everyone, I have a question about the commands “psmatch2” and “pstest”. For propensity score …
Date ConversionHello, I am trying to expend one data set with another data set by using the command "append using,…
Using eydx to calculate percentage difference in Y in difference-in-difference-analysis for men and womenHi everybody I am conducting a DID-analysis. Among other things, I am looking to see how a treatmen…
Categorical Variable errorHi, I'm new to STATA and getting the hang of it. I have a list of 10k directors who hold board posi…
changing the color of one barI want to change the color of one bar in a bar chart, but the bar() option does not seem to help. St…
Subscribe to:
Post Comments (Atom)
0 Response to Set Seed Random Sample
Post a Comment