BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
PunkinSAS08
Fluorite | Level 6

I have a list of over 200 ICD-10 codes and was recommended to use the substr function in SAS to capture all of them ex format. S020XXA and S020XXB

 

I have seen examples where the substr function helps flag the first few characters but how do I use this function to also include the "A" and "B" at the end of my ICD-10 code? I have included some of the icd10 codes needed here for reference: 

 

 
 

S02101A

S02101B

S02102A

S02102B

S02109A

S02109B

S0210XA

S0210XB

S02110A

S02110B

S02111A

S02111B

S02112A

S02112B

S02113A

S02113B

S02118A

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Here's an example of using SUBSTR to also check for "A" or "B" as the last character:

 

if /* some conditions */ and substr(icd10, length(icd10) in "A", "B");

Since you're specifically asking about the last character, I omitted any logic that would check the earlier characters.

View solution in original post

1 REPLY 1
Astounding
PROC Star

Here's an example of using SUBSTR to also check for "A" or "B" as the last character:

 

if /* some conditions */ and substr(icd10, length(icd10) in "A", "B");

Since you're specifically asking about the last character, I omitted any logic that would check the earlier characters.

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 602 views
  • 0 likes
  • 2 in conversation