I need to find whether the string is numeric , character or alphanumeric in SAS
| String | Remarks |
|---|---|
| ABC | Character |
| ABC123 | AlphaNum |
| 1234 | Numeric |
I tried PRXmatch but its not working
>Solution :
Try this
data have;
input String $;
datalines;
ABC
ABC123
1234
;
data want(drop = a n);
set have;
a = anyalpha(string);
n = anydigit(string);
if a and n then Remarks = 'Alphanum ';
else if a and not n then Remarks = 'Character';
else if n and not a then Remarks = 'Numeric ';
run;
Result:
String Remarks
ABC Character
ABC123 Alphanum
1234 Numeric