BookmarkSubscribeRSS Feed
cgray
Fluorite | Level 6

Currently writing a program to extract suicide attempts from a 2016 outpatient hospital discharge file.  In years past, with ICD-9, an e-code of E950-E959 indicated suicide attempts; easy to extract.

 

Now with ICD-10, there are ~300 codes that could indicate intentional self-harm/suicide.  I have an array written to look for these codes over all of the diagnosis fields; however, I am curious to see if there is a way to consolidate the program without writing out all of these codes.  The major problem is that the intentional self harm designation is embedded within a range.

 

For example:  The code for Poisoning by heroin, intentional self-harm is T401X2A.  But, there are also codes for accidental (T401X1A), assault (T401X3A) and undetermined (T401X4A) poisonings that I don't need, prohibiting any use of if dx in : ('T401X'), which would extract the three codes I don't need.

 

Multiply this by 300 or so codes, and that becomes a long program.  Especially when the previous one was if ecode in : ('E95') 🙂

 

Any work around would be appreciated!

 

 

1 REPLY 1
ballardw
Super User

If you have a data set (or even just a list) with the codes then create a custom format that will mark those as "Suicide" and every thing else as "Non-suicide" or whatever term you want.

 

Proc format library=work;

value $suicide

'T401X2A' = 'Suicide'

other = 'Non-Suicide'

;

run;

A data set can work to make a cntlin data set with the formatname values for start, label and a little extra code to add the "other".

 

In a data step you could use thing such as

If (put(code,$suicide.) = 'Suicide' then ...

 

You may search the internet for SAS format ICD-10 as I have heard of number of projects working on bits of this but whether they have your specific need ...

 

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 892 views
  • 1 like
  • 2 in conversation