Deal SAS Users,
I would like to change the order of rows based on the values provided in the "order" column. for example. The order variable only contains the letter the first letter. however, the numbers will be sorted in descending order.
For example:
data have;
input type $ desc $ mo order $10.;
datalines;
A D2 0 B,D
A D1 1 B,D
A B1 2 B,D
B D1 0 D,B
B B0 1 D,B
B D2 2 D,B
B B1 3 D,B
C D2 0 B,D
C D1 1 B,D
C B1 2 B,D
D X2 0 Z,Y,X
D Y1 1 Z,Y,X
D Z1 2 Z,Y,X
;
run;
data want;
input type $ desc $ mo order $ 7-12 new_desc $ 13 - 15;
datalines;
A D2 2 B,D B1
A D1 0 B,D D2
A B1 1 B,D D1
B D1 2 D,B D2
B B0 0 D,B D1
B D2 3 D,B B1
B B1 1 D,B B0
C D2 2 B,D B1
C D1 0 B,D D2
C B1 1 B,D D1
D X2 2 Z,Y,X Z1
D Y1 1 Z,Y,X Y1
D Z1 0 Z,Y,X X2
;
run;
... View more