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!