I am having a dataset with individuals belonging to different groups and I am running a simulation with many repetitions. Per repetition, one individual is randomly drawn from each group using the sample command, e.g.
Code:
*A toy example clear *Generate 100 different groups set obs 100 generate long group=_n *Generate 1000 indivudals per group expand 1000 bysort group: gen individual=_n *Sample 1 individual per group by group: sample 1, count
My problem is that randomtag does not have a by() option, so I can't use it to sample one individual per group. Does anyone has an idea how to accomplish this with randomtag or with another workaround
If anyone has any ideas, please let me know, thank you in advance!
Ali
0 Response to Using randomtag by group
Post a Comment