BookmarkSubscribeRSS Feed
maurora0
Calcite | Level 5

Looking to categorize many ICD 10 codes. Is there a way to do so without typing all of the specific dx codes that fall in the category but instead flagging it if the response matches the general code such as capturing all dx from F10-F10.18 by just typing F10?

 

Thanks!

6 REPLIES 6
Kurt_Bremser
Super User

Use the index() function:

data have;
input icd $10.;
datalines;
F10
F10.18
F20
;
run;

data want;
set have;
where index(icd,'F10') = 1;
run;

proc print data=want noobs;
run;

Result:

icd

F10   
F10.18
andreas_lds
Jade | Level 19

Can you post some icd codes? I haven't seen them for a long time, so it's not easy to suggest something useful.

 

You could do substr(ICDVar, 1, 3) or use something like ICD =: 'F10'. Maybe defining a format would be useful.

 

 

zekeT_sasaholic
Quartz | Level 8

The responses by both @andreas_lds  and @Kurt_Bremser  should suffice for the current way the question is posted.

I agree with both methods and it should simplify your code and/or reduce your typing.

 

A few things I wish we could learn from your question to make sure the responses are fully applicable:

1. Is it only ICD10 and not ICD9.  Because if its a combination - then there could be some innuendos to work out but im not sure thats the case from your question.

2. How many ICD10 categories are you interested in?  Is it only F10? or are there many more? If so how many?  Because maybe its a combination of "SUBSTR" on one table and a merge or join to the list of values you are trying to keep/group.

3. Are the values in your ICD10 column pretty clean and consistent with "."?  If so - a scan function could also work. But i'd likely use the SUBSTR myself.

 

Finally.

While I do think that grouping is a common thing.  I would suggest you confirm what levels and methods to group any ICD Diag/Procedure codes.  Especially 10. 

The code itself is useful with the prefix family of say "F10"- however there are additional digits and values to help with specificity.

Often we as 'data' people might want to group to "F10" - but our clinician friends will help us see what should and should NOT be grouped in that family.  My overall message is - group as needed - but check with clinicians and/or business side about how far to group.

 

I will make up an example here with completely fictitious data:

Procedure       Description

F10             alcohol related disorders

F10.001         Alcohol Abuse

F10.003         Alcohol use Unspecified

F10.21          Alcohol Dependence - In Remission

 

 

I've often seen complex clinician rules on how to group.  We might often see a need to "group" with a complex algo:

1. Group when a claim has "F10" but

2. NOT when there is a "F10.003" or 

3. If the same claim but in a separate "Diag/Proc" code array (1 thru say 25) has a Diag/Proc that is important to this cohort.

An example is often - We want "Alcohol Disorder" cases - but NOT "F10.21 - Alcohol Dependence - in Remission".

 

To me the cool thing about all these codes and Healthcare data is that it keeps me employed!

 

What we should do is talk about complex Diag/Procedure Proc Formats and how to use them to solve this problem.

I'll jump back on later tonight to post something on that if its of interest to this "Group"!

 

Hope this helps have a great week.

Zeke

LinkedIn

sasensei

I'll be at SASGF2019!

 

 

 

 

 

ballardw
Super User

@zekeT_sasaholic wrote:

The responses by both @andreas_lds  and @Kurt_Bremser  should suffice for the current way the question is posted.

I agree with both methods and it should simplify your code and/or reduce your typing.

 

A few things I wish we could learn from your question to make sure the responses are fully applicable:

1. Is it only ICD10 and not ICD9.  Because if its a combination - then there could be some innuendos to work out but im not sure thats the case from your question.

2. How many ICD10 categories are you interested in?  Is it only F10? or are there many more? If so how many?  Because maybe its a combination of "SUBSTR" on one table and a merge or join to the list of values you are trying to keep/group.

3. Are the values in your ICD10 column pretty clean and consistent with "."?  If so - a scan function could also work. But i'd likely use the SUBSTR myself.

 

Finally.

While I do think that grouping is a common thing.  I would suggest you confirm what levels and methods to group any ICD Diag/Procedure codes.  Especially 10. 

The code itself is useful with the prefix family of say "F10"- however there are additional digits and values to help with specificity.

Often we as 'data' people might want to group to "F10" - but our clinician friends will help us see what should and should NOT be grouped in that family.  My overall message is - group as needed - but check with clinicians and/or business side about how far to group.

 

I will make up an example here with completely fictitious data:

Procedure       Description

F10             alcohol related disorders

F10.001         Alcohol Abuse

F10.003         Alcohol use Unspecified

F10.21          Alcohol Dependence - In Remission

 

 

I've often seen complex clinician rules on how to group.  We might often see a need to "group" with a complex algo:

1. Group when a claim has "F10" but

2. NOT when there is a "F10.003" or 

3. If the same claim but in a separate "Diag/Proc" code array (1 thru say 25) has a Diag/Proc that is important to this cohort.

An example is often - We want "Alcohol Disorder" cases - but NOT "F10.21 - Alcohol Dependence - in Remission".

 

To me the cool thing about all these codes and Healthcare data is that it keeps me employed!

 

What we should do is talk about complex Diag/Procedure Proc Formats and how to use them to solve this problem.

I'll jump back on later tonight to post something on that if its of interest to this "Group"!

 

Hope this helps have a great week.

Zeke

LinkedIn

sasensei

I'll be at SASGF2019!

 

 


Please don't forget there is moderate sized subset of ICD-10 (and 9 and ..) that are only used for Cause of Death coding.

maurora0
Calcite | Level 5

Thanks so much for your thoughtful response! 

 

I have a large longitudinal dataset that I have been cleaning and all the codes are ICD 10. Basically it will be used by many researchers to answer a variety of questions. I am interested in presenting groups such as all individuals with some alcohol related dx (yes/no), all with cocaine (yes/no), opioid (yes/no) etc and also group back to main ICD 10 breakdowns simply to make it easier to subset the dataset later on and give some summary statistics of the frequency of most common dx codes. 

 

For example, I would like to reduce the typing to write in every ICD 10 code related to alcohol so I wanted to be able to create a new indicator yes/no variable for alcohol that would be 1 if at least F10 was found in one of their dx codes without typing in all the possible F10 codes that exist. 

 

I appreciate your input! 

Tom
Super User Tom
Super User

SAS makes it easy to test if the beginning of a string matches. Use the colon modifier on the comparison operator.

if code =: 'F10'

To summarize a patient you can use the fact that boolean expression evaluate to 0 or 1.

select patient
 ,sum(code =: 'F10') as alcohol
 ,sum(code =: 'F40') as phobic
from have
group by patient
;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 2972 views
  • 4 likes
  • 6 in conversation