Hey colleagues,
The dataset consists of five key variables from var1 to var5. The five variables are either dichotomous (0/1) or trichotomous (0/1/2). Their combinations divide the observations into 2*2*2*3*3=72 groups. For instance, a group is made up of observations whose var1 is 1, var2 is 2, var3 is 0, var4 1 and var 5 0. My question is how we can randomly select exactly one observation from each group. Do-Loop seems like a must but I have no idea how to do it.
Variable list:
.id
.var1: a continuous variable that can be triply grouped: 0/1/2
.var2: an ordinal variable: 0/1/2
.var3: a dummy variable: 0/1
.var4: a dummy variable: 0/1
.var5: a dummy variable: 0/1
Looking forward to reply and many thanks!
Sincerely
Raymon Lucas
The dataset consists of five key variables from var1 to var5. The five variables are either dichotomous (0/1) or trichotomous (0/1/2). Their combinations divide the observations into 2*2*2*3*3=72 groups. For instance, a group is made up of observations whose var1 is 1, var2 is 2, var3 is 0, var4 1 and var 5 0. My question is how we can randomly select exactly one observation from each group. Do-Loop seems like a must but I have no idea how to do it.
Variable list:
.id
.var1: a continuous variable that can be triply grouped: 0/1/2
.var2: an ordinal variable: 0/1/2
.var3: a dummy variable: 0/1
.var4: a dummy variable: 0/1
.var5: a dummy variable: 0/1
Looking forward to reply and many thanks!
Sincerely
Raymon Lucas
Comment