Surgery Flag Software
Surgery flags are part of the 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.
The Surgery Flag software is being made available for users who would like to identify surgical procedures and encounters in ICD-9-CM or CPT-based inpatient and ambulatory surgery data. AHRQ looks forward to your comments and suggestions for changes and improvements.
The Surgery Flag software was first released in September 2014. The software is updated annually to reflect changes in ICD-9-CM and CPT codes. The initial release was valid for ICD-9-CM codes through September 2013 and CPT codes through December 2013. A second version was released in June 2015. A third version, focusing on CPT only, was released in April 2017. This version brought the Surgery Flag software up to date for CPT codes through 2017. The software assignments were also validated by certified coding specialists.
U.S. Government Rights
The five-character codes included in the Surgery Flag Software are obtained from the Current Procedural Terminology (CPT®), copyright 2016 by the American Medical Association (AMA). CPT is developed by the AMA as a listing of descriptive terms and five–character identifying codes and modifiers for reporting medical services and procedures.
The responsibility for the content of Surgery Flag Software is with the U.S. Department of Health and Human Services, Agency for Healthcare Research and Quality (AHRQ) and no endorsement by the AMA is intended or should be implied. The AMA disclaims responsibility for any consequences or liability attributable or related to any use, nonuse or interpretation of information contained in Surgery Flag Software. Fee schedules, relative value units, conversion factors and/or related components are not assigned by the AMA, are not part of CPT, and the AMA is not recommending their use. The AMA does not directly or indirectly practice medicine or dispense medical services. The AMA assumes no liability for data contained or not contained herein. Any use of CPT outside Surgery Flag Software should refer to the most current Current Procedural Terminology which contains the complete and most current listing of CPT codes and descriptive terms.
CPT is a registered trademark of the American Medical Association.
The Surgery Flag software provides a method for identifying surgeries using International Classification of Diseases, 9th Revision, Clinical Modification (ICD-9-CM) procedure codes and Current Procedural Terminology (CPT®) procedure codes.
CPT is a proprietary coding system developed by the American Medical Association (AMA) for coding services provided by health care professionals. CPT is also referred to as HCPCS Level I. The Surgery Flag ICD-9-CM software is current as of 2015. The Surgery Flag CPT software is current as of 2017. Both can be used with any data that include ICD-9-CM and CPT procedure information.
Approximately 2,600 ICD-9-CM surgical procedure codes (a subset of the 3,882 ICD-9-CM available procedure codes) and over 4,700 CPT surgical procedure codes (a subset of all CPT procedure codes) are classified as a narrowly defined therapeutic invasive surgery (NARROW) or a more broadly defined surgery that includes diagnostic invasive procedures (BROAD).
|Return to Contents|
The Surgery Flag software provides two different schemas for identifying surgical procedures -- one based on the International Classification of Diseases, 9th Version, Clinical Modification (maintained by the National Center for Health Statistics (NCHS) and the Centers for Medicare and Medicaid Services (CMS)), and the other based on the Current Procedural Terminology (CPT®) maintained by the American Medical Association. ICD-9-CM procedure coding is used in facility claims, primarily for inpatient procedures, while CPT procedure coding is used for physician claims and outpatient procedures.
This software includes ICD-9-CM and CPT five-character codes. Descriptive terms for individual Current Procedural Terminology (CPT®) codes are not included because CPT codes are proprietary.
Values for the Surgery Flag Software
A procedure that is classified as a surgery based on a narrow, targeted, and restrictive definition (surgery flag value = NARROW) includes invasive surgical procedures:
An invasive therapeutic surgical procedure involving incision, excision, manipulation, or suturing of tissue that penetrates or breaks the skin; typically requires use of an operating room; and also requires regional anesthesia, general anesthesia, or sedation to control pain.
A procedure that is classified as a surgery based on a broad definition (surgery flag value = BROAD) includes surgical procedures that may not fit the more strict definition of surgery applied for the narrow flag, but are often performed in surgical settings. This definition includes diagnostic surgical procedures:
An invasive therapeutic or diagnostic surgical procedure involving incision, excision, manipulation, or suturing of tissue that penetrates or breaks the skin or enters a body cavity through an existing orifice; typically requires use of an operating room; and also typically requires regional anesthesia, general anesthesia, or sedation to control pain. This includes percutaneous procedures, endoscopic procedures, and all "open" surgical procedures, regardless of therapeutic or diagnostic purpose. By definition, the BROAD flag includes all narrowly defined surgical procedures as well as a broader group of diagnostic and less invasive therapeutic surgeries.
Examples of procedures that are classified as neither NARROW nor BROAD (surgery flag value = NEITHER) include:
Process of Assigning Procedure Codes to Surgery Flags
The classification of procedures began with the ICD-9-CM-based HCUP Procedure Classes tool. The Procedure Classes (PR Class) software classifies all ICD-9-CM codes into one of four mutually exclusive categories (1=Minor Diagnostic Non-operating Room Procedure, 2= Minor Therapeutic Non-operating Room Procedure, 3=Major Diagnostic Operating Room Procedure, and 4=Major Therapeutic Operating Room Procedure). All ICD-9-CM procedure codes in PR Class 4 (major therapeutic) were categorized as NARROW. All ICD-9-CM procedure codes in PR Class 3 were categorized as BROAD (major diagnostic). All ICD-9-CM procedure codes in PR Class 1 were not categorized as NARROW or BROAD.
Next, using information from Weiser, Semel, Simon, et. al. (2011)i , a certified clinical coding specialist, a general surgeon, an analyst, and AHRQ staff reviewed and assigned ICD-9-CM procedure codes in PR Class 2 and determined whether the procedure was NARROW, BROAD, or NEITHER.
The following iterative process was used to assign ICD-9-CM codes to Surgery Flag values:
Following completion of ICD-9-CM code assignments to the Surgery Flag, CPT codes were assigned. Because the Procedure Classes software is an ICD-9-CM based tool and there is no equivalent tool for CPTs, another approach had to be used to efficiently assign CPTs to Surgical Flag values. The surgical CPT code mapping and assignments utilized the Optum and Truven Health Analytics ICD-9-CM to CPT crosswalks for 2013, as well as the ICD-9-CM Backbone file. The crosswalks were used to link CPT codes to equivalent ICD-9-CM codes with a surgical assignment of BROAD or NARROW; ICD-9-CM codes assigned NEITHER were not included in this mapping. Once this was done, a surgery flag assignment was obtained using the ICD-9-CM backbone file. The surgical CPT range was limited to the American Medical Association specified surgical CPT range of 10021-69990.
CPT codes whose crosswalk assignments to ICD-9-CM codes were the same in both crosswalks did not require additional review, although a 1 percent sample was reviewed to gauge consistency and face validity of this approach.
A certified clinical coding specialist, a general surgeon, an analyst, and AHRQ staff systematically reviewed and assigned CPT surgical procedure codes that had an inconsistent assignment in the crosswalks (n=447 CPT codes) or were not included in the crosswalk (n=203 CPT codes).
The following iterative process was used to review 447 CPT codes:
It should be noted that only surgical CPT codes were analyzed; while some medicine or professional CPT codes may code similar procedures, non-surgical codes were not included. For example, angioplasty under surgical CPT codes has a BROAD assignment while angioplasty under medicine CPT codes are considered NEITHER. This applies to CPT codes but is not an issue with ICD-9-CM procedure codes. ICD-9-CM procedure codes are not medical-discipline specific; CPT coding is medical-discipline (medicine versus surgery versus radiology) specific.
Guidelines for Assigning Procedure Codes to Surgery Flags
In the course of assigning ICD-9-CM and CPT codes as a NARROW or BROAD surgery or no surgery (NEITHER), a series of guidelines were developed to ensure consistent code assignments:
|Return to Contents|
Surgery Flag Software
The surgery flag software consists of a SAS program and two files that include information about the classification of procedures into the broad and narrow definitions of surgeries. The surgical flag has value of '0' (NEITHER), '1' (BROAD) or '2' (NARROW). Any code with a value of '2' always has a value of '1' as well; that is '2' NARROW is a subset of '1' BROAD. Separate files are provided for ICD-9-CM classifications and CPT classifications, and the corresponding file names are as follows:
Depending upon the data file that an analyst is using and the analytic objectives, these files can be used alone or together to assign the surgery flag to data with ICD-9-CM procedures, CPT procedures (as defined by the AMA), or both. The surgery flag software files contain flag assignments for all ICD-9-CM procedure codes and all surgical CPT codes (broadly or narrowly defined).
There are two CSV files included with the surgical flag tool. These files can be loaded into almost any kind of database or statistical package. The first two rows of each file contain the field headers and also list the values for the surgical flag:
Sample SAS Load Program
Researchers have the option of creating record-level flags for procedure-level flags. Optional code is included in the top comments section of the program that would create binary BROAD and NARROW surgery flags for each record.
The software includes a sample SAS program ("SURGERY_FLAGS_LOAD_PROGRAM.SAS") that reads in both ICD-9-CM and CPT software files and creates flags to identify surgical procedures based on a BROAD or NARROW definition of surgery.
This SAS program assumes the use of discharge-level data where a single discharge record contains all of the procedure codes on a single line. The SAS load program creates surgery flags for each procedure on a discharge record. Values of '1'=BROAD or '2'=NARROW will be in each flag. Any codes that are not in the software files are assigned a surgery flag of 0.
The program is intended for data with ICD-9-CM procedure codes, CPT procedure codes, or both. By default, the program assumes up to 5 ICD-9-CM procedures and up to 5 CPT procedures are present on each record, although these can be adjusted by changing the following two parameters in the SAS file:
If the data contain only one type of procedure code (i.e., only ICD-9-CM procedure codes or only CPT procedure codes), then set the parameter values such that the value for the taxonomy not in use equals zero, as noted in the example below.
/* SAMPLE SETTINGS APPROPRIATE FOR DATA WITH UP TO 10 ICD-9-CM PROCEDURE CODES PER RECORD AND NO CPT PROCEDURE CODES */
If both types of procedure codes are present in the database, two sets of surgery flags will be created (one for ICD-9-CM and one for CPT), otherwise only one set of flags that corresponds to the type of procedure codes available will be generated. As noted in the "Optional Flags" section below, it is possible that visit records are coded using a mix of ICD-9-CM and CPT taxonomies. In this case, it is advisable to create a record-level flag that summarizes across the multiple ICD-9-CM and CPT flags to make a determination as to whether the record includes at least one NARROW procedure, a BROAD procedure, or both types of procedures, or NEITHER procedures.
Please note that in order to build a list of all discharges with "BROAD" surgeries, analysts will need to capture codes with surgery flag=1 (BROAD) as well as codes that have surgery flag=2 (NARROW) because the NARROW codes are also BROAD by definition.
There are two general sections to the SAS load program:
Users may wish to create a record-level flag (as opposed to procedure-level flag) to identify the entire discharge as surgical or not. In order to do this, analysts should scan the ICD-9-CM or CPT surgery flags created by the program below. If the input data contain both types of procedures, then both sets of surgery flags should be checked. If any surgery flag on a record contains the values '1' or '2', a record-level surgery flag would be created with a possible value of 'surgical'. Otherwise, the record-level flag would have a value of 'not surgical'.
An example of SAS code to do this which could be added at the end of the program follows:
RECORD_FLAG = 'NOT SURGICAL'; %if &NUMI9PRS > 0 %then %do; DO I = 1 TO &NUMI9PRS; IF I9SFLAGS(I) IN('1','2') THEN RECORD_FLAG='SURGICAL'; END; %end; %if &NUMCPTPRS > 0 %then %do; DO I = 1 TO &NUMCPTPRS; IF CPTSFLAGS(I) IN('1','2') THEN RECORD_FLAG = 'SURGICAL'; END; %end;
For data that have both ICD-9-CM and CPT procedure codes, users may wish to create a master set of surgery flags from both procedure types, giving precedence to one type.
To apply Surgical Flag assignments to your SAS dataset, follow these steps:
|Return to Contents|
Prior to downloading the Surgery Flag software, users must agree to a license agreement with the AMA for using CPT codes.
Click here to access Surgery Flag software license agreement.
|Return to Contents|
There are currently no publications using Surgery Flag software.
|Return to Contents|
Questions regarding the Surgery Flag software may be directed to HCUP User Support through the following channels:
|Return to Contents|
CPT only copyright 2018 American Medical Association. All rights reserved.
i Weiser, Semel, Simon, et. al. (2011) In-hospital Death following Inpatient Surgical Procedures in the United States, 1996–2006. World Journal of Surgery. Vol. 35, No. 9, pp. 1950-1956)
|Internet Citation: Surgery Flag Software. Healthcare Cost and Utilization Project (HCUP). June 2018. Agency for Healthcare Research and Quality, Rockville, MD. www.hcup-us.ahrq.gov/toolssoftware/surgflags/surgeryflags.jsp.|
|Are you having problems viewing or printing pages on this Website?|
|If you have comments, suggestions, and/or questions, please contact firstname.lastname@example.org.|
|Privacy Notice, Viewers & Players|
|Last modified 6/20/18|