Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Need to simplfy the code for ICD9
From
Michael Stewart <[email protected]>
To
statalist <[email protected]>
Subject
st: Need to simplfy the code for ICD9
Date
Mon, 27 May 2013 18:13:23 -0400
Hi
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
Step-1:
foreach x in SDX1 SDX2 SDX3 SDX4 SDX5 SDX6 SDX7 SDX8{
icd9 generate disease_`x'= `x', range(296* 300* 309.1 311)
}
Step-2:
egen disease_1=rowmax(disease_SDX1 disease_SDX2 disease_SDX3
disease_SDX4 disease_SDX5 disease_SDX6 disease_SDX7 disease_SDX8)
Step-3:
egen disease=max(disease_1)
Step-4:
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,
Mike.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/