You didn't say what you want to do once you found a record that matched the condition. The following will find the matching records:
data have;
input pancard $10. x y;
if prxmatch("m/[A-Z]{5}\d{4}[A-Z]/oi",pancard) > 0 then found=1;
else found=0;
cards;
DHPLO9635G 1 1
DH1LO9635G 0 0
;
HTH,
Art, CEO, AnalystFinder.com
@art297 can we do the same without using PRXMATCH function?
There's often more than one possible solution to solve a given problem with SAS. In this case you could use something like:
data have; input pancard $10. x y; if (countc(substr(pancard,1,5),,'ai')+ countc(substr(pancard,6,4),,'d')+ countc(substr(pancard,10,1),,'ai')) eq 10 then found=1; else found=0; cards; DHPLO9635G 1 1 DH1LO9635G 0 0 ;
HTH,
Art, CEO, AnalystFinder.com
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.