I have a question about the conditional group dataset:
Here is my dataset:
data temp;
input id x1 x2 $;
cards;
1 25 A
1 35 C
1 20 B
3 33 D
;
run;
I want to group them by id and create a new variable Y. the output should like:
id x1 x2 y
1 25 A C
1 35 C C
1 20 B C
3 33 D D
For example, if id is the same, I need to compare x2 C trumps B, and B trumps A, etc.
how should I code? Thank you very much!