Below is a relatively straightforward solution:
DATA have;
LENGTH member_id $8;
INPUT member_id $;
DATALINES;
A123
A124
B135
C134
D134
E333
®888
¥999
;
RUN;
DATA want;
SET have;
letter = SUBSTR(member_id, 1, 1);
SELECT;
WHEN (letter IN ('A','B','C')) index = 1;
WHEN (letter IN ('D','E','F')) index = 2;
WHEN (letter IN ('G','H','I')) index = 3;
WHEN (letter IN ('J','K')) index = 4;
WHEN (letter IN ('L','M','N')) index = 5;
WHEN (letter IN ('O','P','Q')) index = 6;
WHEN (letter IN ('R','S','T')) index = 7;
WHEN (letter IN ('U','V')) index = 8;
WHEN (letter IN ('W','X')) index = 9;
WHEN (letter IN ('Y','Z')) index = 10;
OTHERWISE DO;
PUT "WARNING: Bad character in letter - " letter;
END;
END;
RUN;
... View more