Hospital Discharge Data ICD-10 Code Shortcut

Occasional Contributor
Posts: 5

Hospital Discharge Data ICD-10 Code Shortcut

[ Edited ]

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') Smiley Happy


Any work around would be appreciated!



Super User
Posts: 13,287

Re: Hospital Discharge Data ICD-10 Code Shortcut

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'



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




Ask a Question
Discussion stats
  • 1 reply
  • 1 like
  • 2 in conversation