Skip Navigation

Surgery Flag Software
The Surgery Flag software is one of the tools that can be applied to HCUP and other similar databases. The Tools are created by AHRQ through a Federal-State-Industry partnership.

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.

Contents:

U.S. Government Rights
This product includes CPT which is commercial technical data, which was developed exclusively at private expense by the American Medical Association, 330 North Wabash Avenue, Chicago, Illinois 60611. The American Medical Association does not agree to license CPT to the Federal Government based on the license in FAR 52.227-14 (Data Rights - General) and DFARS 252.227-7015 (Technical Data - Commercial Items) or any other license provision. The American Medical Association reserves all rights to approve any license with any Federal agency.

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.

Guiding Key Terms:

  • Invasive (does not go through an existing orifice)
  • Therapeutic
  • Pacemakers
  • Robotic-assisted procedures
  • Laparoscopy
  • Layer closure
  • Complex repair
  • Extensive, complicated
  • Penetrating wound
  • Deep
  • Complicated
  • Tissue transfer

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.

Guiding Key Terms:

  • Therapeutic and diagnostic surgeries that go through an existing orifice and require an sterile field
  • Episiotomy
  • Lacerations
  • Endoscopies in conjunction with therapeutic intervention (e.g., incision, removal of polyp, destruction of lesion)
  • Simple repair
  • Subcutaneous/li>
  • Drainage
  • Exploratory (diagnostic)
  • Percutaneous

Examples of procedures that are classified as neither NARROW nor BROAD (surgery flag value = NEITHER) include:

  • Lithotripsy
  • Radiosurgery
  • Closed reduction
  • Colonoscopy without biopsy or removal of tissue (with exceptions noted above)
  • Use of endoscopes for diagnostic purposes only and for which nothing was removed
  • Shaving
  • Identified paired codes (see example below)

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:

  • Each ICD-9-CM code in PR Class 2 was reviewed by a coder and categorized based on the definitions provided above. A coder rationale was provided for each questionable code. It was made clear that "operations" does not necessarily mean that a surgery was performed.
  • If there was not one best category or if there was lack of clarity about what the procedure involved, the general surgeon reviewed the code and categorized it based on the definitions above. A surgeon rationale was provided for each questionable code.
  • AHRQ staff reviewed the codes and the rationale. A list of key terms with expected assignments was developed.
  • Codes were reviewed for consistency of assignments based on key terms, consistency within the three digit grouping of codes, and consistency of treatment of paired codes (identified paired codes were assigned a value of NEITHER since the qualifying surgical code should be assigned a BROAD or NARROW value and be on the same record).
  • Assignments were reviewed for consistency and accuracy.
  • ICD-9-CM code assignments were re-reviewed and discussed and reassignments were made based on consensus.
  • A final review was conducted by AHRQ staff.
  • A final version of the ICD-9-CM file ("ICD-9-CM Backbone file") was created.

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:

  • Each CPT code was reviewed by a coder and categorized based on the definitions and key terms provided above. A coder rationale was provided for each questionable code. It was made clear that "operations" does not necessarily mean that a surgical procedure.
  • If there was not one best category or if there was lack of clarity about what the procedure involved, the general surgeon reviewed the code and categorized it based on the definitions above. A surgeon rationale was provided for each questionable code.
  • AHRQ staff reviewed the codes and the rationale. Additional key terms, unique to the CPT coding system, were identified.
  • Codes were reviewed for consistency of assignments based on key terms, and consistency of treatment of paired codes (identified paired codes were assigned a value of NEITHER since the qualifying surgical code should be assigned a BROAD or NARROW value and be on the same record).
  • Assignments were reviewed for consistency and accuracy.
  • CPT code assignments were re-reviewed and discussed and reassignments were made based on consensus.
  • A final review was conducted by AHRQ staff.
  • A final version of the CPT file ("CPT Backbone file") was created and CPT codes were grouped into ranges to meet the AMA licensing agreement.
  • The final surgical CPT code software file was created from the CPT Backbone containing select fields and CPT codes grouped into ranges .

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:

  • If the code indicated that it may include an invasive process, the code was considered more narrowly defined and were assigned as NARROW.

    Example:

    • 54550 - Exploration for undescended testis (inguinal or scrotal area) - NARROW
    • 63275 - Laminectomy for biopsy/excision of intraspinal neoplasm; extradural, cervical - NARROW


  • If the code indicated an "oscopy" in conjunction with any other therapeutic intervention, the code was assigned as BROAD.

    Example:

    • 43200 - Esophagoscopy, rigid or flexible; diagnostic, with or without collection of specimen(s) by brushing or washing (separate procedure) - BROAD
    • 47555 - Biliary endoscopy, percutaneous via T-tube or other tract; with dilation of biliary duct stricture(s) without stent - BROAD


  • If the code indicated a procedure that went through an existing orifice and required a sterile field, it was coded as BROAD.

    Example:

    • 69205 - Removal foreign body from external auditory canal; with general anesthesia - BROAD
    • 67938 - Removal of embedded foreign body, eyelid - BROAD


  • If the code was for a laparoscopic procedure that by definition requires an incision, the code could be categorized as NARROW or BROAD, depending in part on whether the procedure was intended to be therapeutic (rather than diagnostic) in nature. Procedures that were intended to be therapeutic were classified as NARROW, and procedures that were diagnostic were classified as BROAD. When the intent of the procedure could not be determined, the procedure was generally classified as BROAD.

    Example:

    • 38120 - Laparoscopy, surgical, splenectomy – NARROW
    • 38571 - Laparoscopy, surgical; with bilateral total pelvic lymphadenectomy - NARROW
    • 38570 - Laparoscopy, surgical; with retroperitoneal lymph node sampling (biopsy), single or multiple - BROAD
    • 43605 - Biopsy of stomach, by laparotomy - BROAD


  • • If the code indicated that it was to be used only with another surgery code (i.e,. paired code), the code was assigned as not being a surgery (NEITHER).

    Example: CPT Codes for Cervical Laminectomy/Discectomy

    • 22100 - Partial excision, posterior vertebral component, single segment - NARROW
    • 22013 - Partial excision, posterior vertebral component, each additional segment (which cannot stand alone and must be used with another surgery code) - NEITHER
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:

  • SURGERY_FLAGS_I9_2015.CSV
  • SURGERY_FLAGS_CPT_2017.CSV

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).

CSV Files

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:

  • The ICD-9-CM CSV file has three columns of information. The first column specifies the ICD-9-CM procedure code. The second column indicates the surgical flag for the code (1=BROAD, 2= NARROW). The third column provides the ICD-9-CM procedure label.
  • The CPT CSV file differs from the ICD-9-CM version. In the first column users will find a range of CPT codes. Individual codes and labels are not listed in this file per agreement with the AMA. In the second column users will find the surgical flag that corresponds to the range of codes.

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:

%LET NUMI9PRS=5;
%LET NUMCPTPRS=5;

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 */
%LET NUMI9PRS=10;
%LET NUMCPTPRS=0;

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.

Program Structure

There are two general sections to the SAS load program:

  1. In the first phase, the program loads the two CSV files into SAS then creates temporary SAS formats to be used later.
  2. In the second phase, the formats created above are applied to the researcher's SAS dataset in order to create the surgery flags. The default action is to create sets of either ICD-9-CM or CPT or both surgery flags for each record on a dataset. These are procedure-level flags, and the number of flags depends on the number of procedures on each record as specified by the user.

Optional Flags

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.

Step-by-Step Guide

To apply Surgical Flag assignments to your SAS dataset, follow these steps:

  • Save the CSV files and SAS program to a directory of your choosing.
  • Identify the location of the SAS dataset you wish to augment.
  • Edit the SAS load program so that:
    • The correct directory path for the CSV files and your SAS dataset is specified.
    • The maximum number of ICD-9-CM and CPT codes found on each record is indicated.
    • Your SAS dataset name is provided.
    • The names of the CPT and Procedure codes match those on your SAS file.
  • Run the SAS program and examine the output to make sure the surgery flags were created correctly. A partial printing of 10 records is executed by the load program.
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 hcup@ahrq.gov.
Privacy Notice, Viewers & Players
Last modified 6/20/18