Hello Everyone,
I have a dataset which has data for 100 households from each of 3 cities. Further, 5 members from each household are listed in the dataset. So in total, I have 1500 (3*100*5) observations. The household members are divided into 20 groups based on certain characteristics (each member is assigned a group number between 1 and 20).
Lets call the variables as city, household, member and group.
I want to select (using sample command or any other efficient method) 20 members from each city (one from each group). My condition is that only one member can be selected from each household.
When I run the following command:
bysort city group: sample 1, count
I get one member sampled from each group within each city but this command selects (in some cases) more that one members from one household.
What I want is if one member is selected from some group from household1, then no other member in a particular city should be sampled from household1 and one member from each group should also be selected from each city.
Kindly advise how can I achieve this.
Thank you!
Amit
Related Posts with Sampling using sample command
Collapsing survival dataDear all, I have a very big data set with a survival structure that I want to compress/collapse. Ri…
Difficulties in running xtabond2 command in stata v16Dear all, I just installed stata 16 IC and subsequently installed xtabond2 command. However, I often…
Open password protected ".dta" file (I have the password)Dear All, I have received data files (.dta) which is protected with a password (I have the password…
How to interpret sigma_u (between subject) and sigma_e (within subject) in Fixed-effects modelDear all, I'm running a fixed-effects model and need help interpreting sigma_u (between subject) an…
Possible bug in -bootstrap-Currently, I only have access to Stata 11 to 14. In these releases, there appears to be a bug in boo…
Subscribe to:
Post Comments (Atom)
0 Response to Sampling using sample command
Post a Comment