Skip Navigation

Comorbidity Software, Version 3.7
The Comorbidity Software is one of the HCUP tools that can be applied to HCUP and other similar databases. These tools are created by AHRQ through a Federal-State-Industry partnership.
Comorbidity Software, Version 3.7

ICD-9-CM codes were frozen in preparation for ICD-10 implementation and regular maintenance of the codes has been suspended. The HCUP Tools for ICD-9-CM should only be used with data for discharges before 10/1/2015.

The Comorbidity Software is one in a family of databases and software tools developed as part of the Healthcare Cost and Utilization Project (HCUP), a Federal-State-Industry partnership sponsored by the Agency for Healthcare Research and Quality. HCUP databases, tools, and software inform decision making at the national, State, and community levels.


Comorbidity software assigns variables that identify comorbidities in hospital discharge records using the diagnosis coding of ICD-9-CM (International Classification of Diseases, Ninth Edition, Clinical Modifications). This document describes the software that creates the comorbidity measures reported by Elixhauser et al. ("Comorbidity Measures for Use with Administrative Data." Medical Care, 1998;36:8-27).

Select to download software.

The comorbidity software consists of two SAS computer programs for PCs. Although these programs are written in SAS, they are being distributed in ASCII so that they can be readily adapted to other programming languages.

The first program, Creation of Format Library for Comorbidity Groups, creates a SAS format library that maps diagnosis codes into comorbidity indicators. Additional formats are also created to exclude conditions that may be complications or that may be related to the principal diagnosis:
  • Comformat2012-2015.txt is designed for files that include MS-DRG version 29 or later.
The second SAS program, Creation of Comorbidity Variables, applies the formats created above to a data set containing administrative data and then creates the comorbidity variables:
  • Comoanaly2012-2015.txt is intended for use with data containing MS-DRGs.
This documentation describes three topics:
  • Data elements required for the programs.
  • The SAS programs.
  • How to use the SAS programs on an IBM-compatible PC.
Return to Contents

The input data file must contain certain elements that are coded in specific ways. These elements are required for the assignment of the comorbidity flags. The flags are 0/1 indicators that note whether individual records include each comorbidity.

The input data set must have the following two variables:
  1. Diagnosis-related groups (DRG or MS-DRG).
  2. Diagnostic codes (ICD-9-CMs).
The required elements and coding are described in more detail below.

Required Elements of Input File
Element Type Length Label and Uniform Coding
DRG Num 3 DRG or MS-DRG in effect on discharge date, assigned by the DRG Grouper algorithm of the Centers For Medicarer & Medicaid Services (CMS), formerly the Health Care Financing Administration (HCFA)
DX1 Char 5 Principal diagnosis, annnn (blanks indicate missing)
DX2-DXn Char 5 Secondary diagnoses 2-n, where n varies by data set
NDX Num 3 Number of diagnoses on this discharge. (Note: A macro variable defines this element; it is currently set as 2.) NDX should always be equal or less than the macro variable called NUMDX.

Select for Text Version. (PDF file, 10 KB)
Return to Contents

Creation of Format Library for Comorbidity Groups
The format program defines a format library that contains the diagnosis and DRG/MS-DRG screens necessary for the comorbidity analysis. The format library is referenced by the comorbidity analysis program.
  • Input: None
  • Output: Permanent SAS format library called \FMTLIB\formats.sc2.
  • Changes: The code points to a directory called FMTLIB on the c: drive for the format library output file. If you use another directory or drive, this code must be changed. Initially, this directory should be defined.
Return to Contents

Creation of Comorbidity Variables

The analysis program assigns 0/1 indicators to the inpatient records for the comorbidity variables of interest. This program assumes that the input data file conforms to specific variables names, attributes, and coding conventions, as described above. There is one version of this program that works with either DRG or MS-DRG.
  • Input: SAS inpatient data (CORE) conforming to HCUP coding conventions (described above), and SAS format library (FMTLIB), created from the included format program.
  • Output: SAS data set (ANALYSIS) containing inpatient records with their comorbidity indicators. The contents of the ANALYSIS file and the means for the comorbidity variables are output as hard copy. The output file is called ANALYSIS; if your file name differs, the DATA statement needs to be changed.
  • Changes: The code points to a directory called DATA on the c: drive for the input and output files. If you use another directory or drive, this code must be changed. Initially, the DATA directory needs to be defined. The macro variable (NUMDX) that defines the number of diagnoses on your data file needs to be defined (change the "2" to the appropriate number).
The macro variable (CORE) that defines the input file (SASname) needs to be defined; change the XXXXXX to the appropriate name.

There is an options statement that defines page and line size preferences; the settings currently are linesize=159 and pagesize=56. These settings can be changed, depending upon whether you prefer portrait or landscape style output.
Return to Contents

ICD-9-CM and DRG/MS-DRG coding changes through September 30, 2015, are incorporated into this software. (Note that there were no new diagnosis codes for FY 2015.)
  • Changes to the Comorbidity Software for FY2012-2015, Version 3.7 are summarized in Table1-FY2012-V3_7 (PDF file, 10 KB).
  • Changes to the Comorbidity Software for FY2011, Version 3.6 are summarized in Table1-FY2011-V3_6 (PDF file, 13 KB).
  • Changes to the Comorbidity Software for FY2010, Version 3.5 are summarized in Table1-FY2010-V3_5 (PDF file, 12 KB).
  • Changes to the Comorbidity Software for FY2009, Version 3.4 are summarized in Table1-FY2009-V3_4 (PDF file, 17 KB).
  • Changes to the Comorbidity Software for FY2008, Version 3.3 are summarized in Table1-FY2008-V3_3 (PDF file, 15 KB).
  • Changes to the Comorbidity Software for FY2007, Version 3.2 are summarized in Table1-FY2007-V3_2 (PDF file, 15 KB).
  • Changes to the Comorbidity Software for FY2006, Version 3.1 are summarized in Table1-FY2006-V3_1 (PDF file, 15 KB).
  • Changes for FY2005, Version 3.0 are summarized in Table1-FY2005-V3_0 (PDF file, 17 KB).
  • Changes for FY2004, Version 2.1 are summarized in Table1-FY2004-V2_1. (PDF file, 39 KB).
Return to Contents

The library contains formats for the ICD-9-CM codes and DRG/MS-DRG screens. Construction of these variables is summarized in Table 2. (PDF file, 170 KB)

The original table appeared in the paper by Elixhauser et al (1998). This table has been updated to reflect the ICD-9-CM and DRG/MS-DRG updates in the software.

Return to Contents

Web Browser Download: Your browser may support loading the files from this Web page. To download the files from this page, click on the following links with the right mouse button and select "Save Link As" (Mozilla) or "Save Target As" (Internet Explorer). After saving a file, find the file by using Windows® Explorer (Windows® 95/98/NT/2000/XP) or File Manager (Windows® 3.x) and then open it by double-clicking on the file name. Though they are written in SAS, all files are being distributed in ASCII so they can be readily adapted to other programming languages.
Return to Contents

Copies of previous versions of the Comorbidity Software are available for users who need to replace or access the old SAS programs.
Return to Contents
The following publications are examples of the many studies that have used this comorbidity algorithm:

Ahern,M. M., Hendryx,M. Avoidable hospitalizations for diabetes: comorbidity risks. Disease management: DM, 10(6):347-355 , December 2007.

Baldwin LM, Klabunde CN, Green P, Barlow W, Wright G. In search of the perfect comorbidity measure for use with administrative claims data: does it exist? Med Care. 2006 Aug;44(8):745-53.

Bass E, French DD, Bradham DD, Rubenstein LZ. Risk-adjusted mortality rates of elderly veterans with hip fractures. Ann Epidemiol. 2007 Jul;17(7):514-9. Epub 2007 Apr 8.

Brasel KJ, Guse CE, Layde P, Weigelt JA. Rib fractures: relationship with pneumonia and mortality. Crit Care Med. 2006 Jun;34(6):1642-6.

Carney CP, Jones L, Woolson RF. Medical comorbidity in women and men with schizophrenia: a population-based controlled study. J Gen Intern Med. 2006 Nov;21(11):1133-7.

Cots F, Castells X, Mercade L, Torre P, Riu M. [Article in Spanish]. [Ajuste del riesgo: mas alla de los sistemas de clasificacion de pacientes]. Gac Sanit. 2001 Sep-Oct;15(5):423-31.

Dominick KL, Dudley TK, Coffman CJ, Bosworth HB. Comparison of three comorbidity measures for predicting health service use in patients with osteoarthritis. Arthritis Rheum. 2005 Oct 15;53(5):666-72.

Farley JF, Harley CR, Devine JW. A comparison of comorbidity measurements to predict healthcare expenditures. Am J Manag Care. 2006 Feb;12(2):110-9.

French DD, Campbell R, Spehar A, Angaran DM. Benzodiazepines and injury: a risk adjusted model. Pharmacoepidemiol Drug Saf. 2005 Jan;14(1):17-24.

French DD, Campbell R, Spehar A, Rubenstein LZ, Accomando J, Cunningham F. National Veterans Health Administration hospitalizations for syncope compared to acute myocardial infarction, fracture, or pneumonia in community-dwelling elders: outpatient medication and comorbidity profiles. J Clin Pharmacol. 2006 Jun;46(6):613-9.

French DD, Bass E, Bradham DD, Campbell RR, Rubenstein LZ. Rehospitalization After Hip Fracture: Predictors and Prognosis from a National Veterans Study. J Am Geriatr Soc, November 15, 2007 [Epub ahead of print]

Glance LG, Dick AW, Osler TM, Mukamel DB. Does date stamping ICD-9-CM codes increase the value of clinical information in administrative data? Health Serv Res. 2006 Feb;41(1):231-51.

Ho KM, Finn J, Knuiman M, Webb SA. Combining multiple comorbidities with Acute Physiology Score to predict hospital mortality of critically ill patients: a linked data cohort study. Anaesthesia. 2007 Nov;62(11):1095-100.

Johnston JA, Wagner DP, Timmons S, Welsh D, Tsevat J, Render ML. Impact of different measures of comorbid disease on predicted mortality of intensive care unit patients. Med Care. 2002 Oct;40(10):929-40.

Kurichi JE, Stineman MG, Kwong PL, Bates BE, Reker DM. Assessing and using comorbidity measures in elderly veterans with lower extremity amputations. Gerontology. 2007;53(5):255-9. Epub 2007 Apr 13.

Li B, Evans D, Faris P, Dean S, Quan H. Risk adjustment performance of Charlson and Elixhauser comorbidities in ICD-9 and ICD-10 administrative databases. BMC Health Services Research, 8:12, 2008.

Livingston EH, Rege RV. Technical complications are rising as common duct exploration is becoming rare. J Am Coll Surg. 2005 Sep; 201(3):426-33.

Livingston EH. Development of bariatric surgery-specific risk assessment tool. Surg Obes Relat Dis. 2007 Jan-Feb;3(1):14-20; discussion 20. Epub 2006 Dec 27.

Mitchell, Jean M. Effects Of Physician-Owned Limited-Service Hospitals: Evidence From Arizona. Health Affairs. 2005 Oct 25.

Quan H, Sundararajan V, Halfon P, et al. Coding algorithms for defining comorbidities in ICD-9-CM and ICD-10 administrative data. Med Care 2005 Nov; 43(11):1073-1077.

Robinson,D.,Jr, Eisenberg,D., Nietert,P. J., Doyle,M., Bala,M., Paramore,C., Fraeman,K., Renahan,K. Systemic sclerosis prevalence and comorbidities in the US, 2001-2002. Curr Med Res Opin, 24(4):1157-66, April 2008.

Southern DA, Quan H, Ghali WA. Comparison of the Elixhauser and Charlson/Deyo methods of comorbidity measurement in administrative data. Med Care. 2004 Apr;42(4):355-60.

Stukenborg GJ, Wagner DP, Connors AF Jr. Comparison of the performance of two comorbidity measures, with and without information from prior hospitalizations. Med Care. 2001 Jul;39(7):727-39.

Tang,J., Wan,J. Y., Bailey,J. E. Performance of comorbidity measures to predict stroke and death in a community-dwelling, hypertensive Medicaid population. Stroke, 39(7):1938-44, July 2008, Epub 2008 Apr 24.

Thombs BD, Singh VA, Halonen J, Diallo A, Milner SM. The effects of preexisting medical comorbidities on mortality and length of hospital stay in acute burn injury: evidence from a national sample of 31,338 adult patients. Ann Surg. 2007 Apr;245(4):629-34.

van Walraven C, Austin PC, Jenings A, Quan H, Forster AJ. A modification of the Elixhauser comorbidity measures into a point system for hospital death using administrative data. Medical Care. 2009 (47):626-633.

Weinhandl,E. D., Snyder,J. J., Israni,A. K., Kasiske,B. L. Effect of comorbidity adjustment on CMS criteria for kidney transplant center performance. American journal of transplantation, 9(3):506-16, March 2009.

Werner RM, Asch DA, Polsky D. Racial Profiling: The Unintended Consequences of Coronary Artery Bypass Graft Report Cards. Circulation, 111:1257-1263, 2005;

Yan Y, Birman-Deych E, Radford MJ, et al. Comorbidity indices to predict mortality from Medicare data: results from the National Registry of Atrial Fibrillation. Med Care. 2005 Nov; 43(11):1073-1077.

Zhu,H., Hill,M. D. Stroke: the Elixhauser Index for comorbidity adjustment of in-hospital case fatality. Neurology, 22;71(4):283-7, July 2008.
Return to Contents

Internet Citation: HCUP Comorbidity Software. Healthcare Cost and Utilization Project (HCUP). April 2016. Agency for Healthcare Research and Quality, Rockville, MD.
Are you having problems viewing or printing pages on this Website?
If you have comments, suggestions, and/or questions, please contact
Privacy Notice, Viewers & Players
Last modified 4/26/16