Date: Tue, 22 Feb 2005 15:21:22 -0600
Reply-To: Duck-Hye Yang <dyang@CHAPINHALL.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Duck-Hye Yang <dyang@CHAPINHALL.ORG>
Subject: Re: Is there a sas code that can clean up ICD-9 codes?
Content-Type: text/plain; charset=US-ASCII
Thank you for your code!
I will check if it is helpful for me.
I posted my question because I was bothered the most by the following
Medicaid data has '3153','31530','31531','31532'.
The CMS label you mentioned below has only 2 lables as valid ones--the
last two: '31531','31532'. These two belong to higher aggregation
classification code , 74 other mental.
The first three are not valid ICD-9 codes. However, I think that they
should not be classified 'missing'.
I want to include them as 74 other mental.
Do you think that your code help me in fixing that type of errors?
>>> Jonathan Kerman <jkerman@JHMI.EDU> 02/22/05 2:20 PM >>>
I have been doing a fair amount of work with ICD-9 codes. I could
you with some of what I did. Basically, I checked a text string to
sure it has the format of a valid ICD-9 code, or reject it. I also
dataset that maps ICD-9 codes to text descriptions.
I got my input files from the Centers for Medicare and Medicaid
After I read these text files, one for diagnosis codes and one for
codes, into SAS datasets, this is the code I used to build a single
table. It places a decimal point at the proper place, and creates the
mapping of codes to descriptions. (I found that there are still some
that are not found in these CMS files.)
See if this helps...
libname comp "[location with SAS datasets]";
/* Build a lookup table with standardized, short descriptions of ICD-9
taken from CMS
length CODE tmp $ 6 DESCRIPTION $ 30;
set comp.icd9diag (in=diag) comp.icd9proc (in=surg);
if diag then do;
if substr(code, 1, 1) = 'E' then do; /* for 'E' code diagnoses,
format is different */
substr(tmp, 1, 4) = substr(code, 1, 4);
if length(code) > 4 then do;
substr(tmp, 5, 1) = '.';
substr(tmp, 6, 1) = substr(code, 5, 1);
else do; /* for numeric ICD-9 diagnoses and for 'V' codes use this
substr(tmp, 1, 3) = substr(code, 1, 3);
if length(code) > 3 then do;
substr(tmp, 4, 1) = '.';
substr(tmp, 5, 2) = substr(code, 4, 2);
else if surg then do; /* for procedure codes, use this format */
substr(tmp, 1, 2) = substr(code, 1, 2);
if length(code) > 2 then do;
substr(tmp, 3, 1) = '.';
substr(tmp, 4, 2) = substr(code, 3, 2);
code = tmp;