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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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