Tom,
scan() has built-in modified option for this kind of situation.
data have;
input string $20.;
cards;
E90K
G1006AfsX51
W1001X
R1014X
D102A
G1036D
R1035G fsX22
R1035fsX1056
C52AfsX8
;
data want ;
set have ;
numb = scan(string,1,,'kd');
run;
... View more