/*Data manupulation Provide a sequence ID, that is ... To go from 2 2 2 5 5 3 to 1 1 1 2 2 3 */ data test; input x; cards; 2 2 2 5 5 3 ; proc sort data=test; by x; data new; set test; by x; retain count 1; rank=count; if last.x then count+1; run; proc print data=new; run;