@novinosrin
a while ago, you helped about pick 2 people from a certain number of people. Now if I want to choose 4 people from a certain number of people, I am trying to modify the code you helped, but there are error messages, could you help please. Below is the code for picking 4 people from a certain number of people, but it doesn't work, please help. Thanks much!
data want; set have; array c col:; length cat $30 Pair $20; do _i=1 to dim(c)-1; do _j=_i+1 to dim(c); do _m=_j+1 to dim(c)+1; do _n=_m+1 to dim(c)+2; k1=c(_i); k2=c(_j); k3=c(_m); k4=c(_n); Pair=catx('_','Pair',_i,_j,_m,_n); if k1=k2=k3=k4=itemkey then cat="same resp and all correct"; else if k1=k2=k3=k4^=itemkey then cat="same resp and all wrong"; else if _i=itemkey or _j=itemkey or _m=itemkey or _n=itemkey then cat="different resp and one of them correct"; else cat="different resp and all wrong"; output; end; end; end; end; keep itempos itemkey cat pair; run;
... View more