data title;
input x$;
cards;
a
c
b
b
a
c
b
;
run;
proc sort data=title out=title1;
by x;
run;
data title2;
set title1(in=Q where=(x='a')) title1(in=W where=(x='b')) title1(in=E where=(x='c'));
if Q then index=1;
if W then index=2;
else if E then index=3;
run;