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
Fixed effects in first-differenced modelHi! I have a first-differenced model, where my units are municipalities. I am adding regional fixed…
Rolling estimates with confidence intervals (graph)Dear all, I found this question here. Please ssc install rangestat. The question is, after running r…
Replace string value with a missing value (dot)I have a dataset with a variable "sex". I would like to know how can I replace a string value "missi…
JackknifeHello everyone, I have a question about comparing linear regression model and jackknife method. I e…
Discrepancy for Shapiro-Wilks value between Stata (v15) vs. SPSS 26 and JASP 15.Hello, This is an unusual question as it involves statistical platforms outside of Stata. I'm teach…
Subscribe to:
Post Comments (Atom)
0 Response to Set Seed Random Sample
Post a Comment