Comorbidity SAS Macro (2000 version)
This version of the macro calculates Charlson comorbidity weights from the claims and was developed in 2000.
Investigators who want to calculate the 2000 version of the comorbidity scores will need to use the macro (charlson.comorbidity.macro.v2000.txt (TXT, 18 KB)). The “rule-out” macro (remove.ruleout.dxcodes.macro.v2000.txt (TXT, 10 KB)) is only needed if both physician/outpatient and hospital (MedPAR) claims are being used to identify comorbid conditions. This macro requires that for physician and outpatient claims, a patient's diagnosis code must appear on at least two different claims that are more than 30 days apart. The reason for this is that the diagnoses on the physician and outpatient claims have not been validated and it is possible that physicians may have recorded a diagnosis as being present, when the correct coding would be “rule-out” the condition. Codes that do not appear on two different claims are considered to be “rule-out” diagnoses and are not counted as comorbid conditions. This is necessary to prevent over-estimation of the comorbidity when using physician or outpatient claims.
Building an Input File for the Macros
Regardless of which files an investigator decides to use, the files should be subset to include a limited number of variables as described below. All ICD-9-CM diagnosis codes on these records should be 5 characters long and ICD-9-CM procedure codes should be 4 characters long. Before invoking the SAS macros, decimal points or blanks occurring within the number should be removed from the code (ex. diagnosis code '123.4' becomes '1234').
Variables to keep for the macros:
- MEDPAR - keep Patient_ID (or REGCASE), admission date, diagnosis codes 1-25, surgery codes 1-25, and length of stay. Set filetype=M.
- NCH - keep Patient_ID (REGCASE), claim from date, HCPCS, diagnosis codes 1-13 (twelve of the diagnoses are from the header of the claim and one is the line item diagnosis). The carrier data can have more than one claim for the same date of service and all claims for each date should be included. Set filetype=N.
- Outpatient - keep Patient_ID (or REGCASE), claim from date, HCPCS, diagnosis codes 1-25, ICD procedure codes 1-13. Set filetype=O.
The final SAS file which combines data from any of the above sources must include the variables used in the Macro call. For each record a flag (IDXPRI) needs to be created to flag records that fall within the window of analysis. For example, if the comorbidity score for the 12 months prior to diagnosis is to be calculated, then records with claim dates falling within that window should have IDXPRI set to "P". If however the window is to be the month of diagnosis, then records with the claim date within the month of diagnosis should have IDXPRI set to "I". Records not in the analysis window should have IDXPRI left blank or should be excluded from the final SAS file.
These variables are needed for the Comorbidity macro:
PATID - Patient ID
IDXPRI - Event Window indicator, "P"=Prior, "I"=Index
DAYS - Length of stay for Hospital visits, only for MEDPAR records
DXVARSTR - Diagnosis array, such as DX1-DX25. Note: DX14-DX25 are blank for NCH/carrier data
NDXVAR - Number of variables in Diagnosis array, maximum 25
SXVARSTR - Procedure array, such as surgery codes from MEDPAR and procedure codes from Outpatient. Note: These are blank for NCH/carrier data
NSXVAR - Number of variables in Procedure array, maximum 25
HCPCS - Outpatient and NCH/Carrier procedure codes in CPT-4. Note: This is blank for MEDPAR records
FILETYPE - M-MEDPAR, N-NCH/Carrier, O-Outpatient
These variables are needed for the rule-out macro:
PATID - Patient ID
CLMDTE - Admission date from Medpar, claim from date from NCH/carrier and Outpatient (in SAS date format)
START - Start of comorbidity window, such as 12 months prior to Diagnosis Date (in SAS date format)
FINISH - End of comorbidity window, such as 1 month prior to Diagnosis Date (in SAS date format)
DXVARSTR - Diagnosis array, such as DX1-DX25. Note: DX14-DX25 are blank for NCH/carrier data
NDXVAR - Number of variables in Diagnosis array, maximum 25
HCPCS - Outpatient and NCH/Carrier procedure codes in CPT-4. Note: This is blank for MEDPAR records
FILETYPE - M-MEDPAR, N-NCH/Carrier, O-Outpatient