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
 install ado filesHello,
I am trying to install some ado files which I downloaded from a website in my stata. I read … install ado filesHello,
I am trying to install some ado files which I downloaded from a website in my stata. I read …
 Syntax for funnel plotHello,
I'm trying create a funnel plot for a meta-analysis of pre-calculated effect estimates (RR)
… Syntax for funnel plotHello,
I'm trying create a funnel plot for a meta-analysis of pre-calculated effect estimates (RR)
…
 stationarity of explanatory variables in time series regressionsI'm finding myself confused and unable to find good answers to what seems to be a simple question:
… stationarity of explanatory variables in time series regressionsI'm finding myself confused and unable to find good answers to what seems to be a simple question:
…
 How to deal with missings on partner information if the person has no partner?Dear all,
I use panel / survey data and in my estimations I include variables like "age of partner"… How to deal with missings on partner information if the person has no partner?Dear all,
I use panel / survey data and in my estimations I include variables like "age of partner"…
 Dummy Variables - New to Stata - Gender pay-gap policyHello,
I have recently started learning Stata and have been playing around with data sets. The obse… Dummy Variables - New to Stata - Gender pay-gap policyHello,
I have recently started learning Stata and have been playing around with data sets. The obse…
Subscribe to:
Post Comments (Atom)
0 Response to Set Seed Random Sample
Post a Comment