Hi @Saikiran_Mamidi
You can use the PRXMATCH function for example:
data want;
set have;
if prxmatch('/^\d{5}[a-z]$/',strip(names)) then output;
run;
It looks for the following pattern: ^\d{5}[a-z]$
^ = beginning of the string
\d{5} = 5 digits
[a-z] = one letter (case insensitive -> cf "i" modifier)
$ = end of the string
strip() enables to take into account trailing blanks.
You could also use:
if prxmatch('/^\d{5}[a-z]\s*$/i',names) then output;
-> \s means a blank and * means 0,1 or more times -> looks for trailing blanks