Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Need to simplfy the code for ICD9

From   Michael Stewart <>
To   statalist <>
Subject   st: Need to simplfy the code for ICD9
Date   Mon, 27 May 2013 18:13:23 -0400

I am trying to find an efficient code for working with ICD9 doagnosis codes

At present: To create a variable (1/0) which denotes if there is/are
ICD9 codes for a disease in the ICD9 section of the database  , I am
using a 4 step code  as folows


foreach x in SDX1 SDX2 SDX3 SDX4 SDX5 SDX6 SDX7 SDX8{
icd9 generate disease_`x'= `x', range(296* 300* 309.1 311)

egen disease_1=rowmax(disease_SDX1 disease_SDX2 disease_SDX3
disease_SDX4 disease_SDX5 disease_SDX6 disease_SDX7 disease_SDX8)

egen disease=max(disease_1)

drop disease_SDX*  disease_1

Is there a more elegant, code that can be executed in lesser number of steps .

Please help me .

Thank you ,
Yours Sincerely,
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index