Hi SAS Pros,
I have a dataset that each ID has many observations. I want to create two variables. One is called combination with the values from a1 to a5. The other is called type, which is assigned with different value for different combination and same value for same combination. But the combinations assigned with a same number between different IDs don't necessarily have to be the same. For example, the combination of 'axoo1' for ID=1 with a value of 1 in type is different with the combination of 'esjl4' for ID=2 who also has a value of 1 in type. The value for type within each ID should be continuous.
data Have;
length a1 $1 a2 $1 a3 $1 a4 $1 a5 ;
infile datalines;
input ID a1 a2 a3 a4 a5 ;
return;
datalines;
1 a x o o 1
1 b x o p 2
1 c y q s 6
1 c y q s 6
2 e s j l 4
2 h e w p 5
2 k k u u 9
2 k k u u 9
2 q q s i 7
;
run;
What I want:
ID a1 a2 a3 a4 a5 type combination
1 a x o o 1 1 axoo1
1 b x o p 2 2 bxop2
1 c y q s 6 3 cyqs6
1 c y q s 6 3 cyqs6
2 e s j l 4 1 esjl4
2 h e w p 5 2 hewp5
2 k k u u 9 3 kkuu9
2 k k u u 9 3 kkuu9
2 q q s i 7 4 qqsi7
Thank you so much for any help!
Best regards,
C