I am creating a series of if/then statements to assign a large number of various ICD10 codes to a few specific groups in a new variable. This has been going fine until I noticed I have hundreds of individual values to put in my "in: ('a','b')" parentheses for one particular value of this new variable. These values all end in 1 of 6 digits, but go from the low 300's up through the 800's. example:
V324,V325,V326,V327,V328,V329
V334,V335,V336,V337,V338,V339
V344,V345,V346,V347,V348,V349
My question is, is there some character I can insert to represent any value? So that I could put something like "in: ('V3*4', 'V3*5','V3*6',)" etc? Or some way to not manually enter these hundreds of codes? I can't just use 'V32' because these values don't include V320, V321, etc. Thank you!
> something like "in: ('V3*4', 'V3*5','V3*6',)"
Like this?
if prxmatch('/\AV3\d[456]\Z/',trim(VAR)) then C=1;
\A = start of string
V3
\d = digit
4 or 5 or 6
\Z = end of string
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.