Set Yourself Free-- Use ODS Report Writing Technology in SAS Enterprise Guide Instead of Dynamic Data Exchange in PC SAS Part II: SAS Code Revealed Robert R. Springborn, Ph.D. Healthcare Outcomes Center, Office Statewide Health Planning & Development Sacramento, California Copyright © 2010, SAS Institute Inc. All rights reserved.
Talk Overview First we will review highlights of my WUSS 2012 paper, Part I: Introduction. http://www.sascommunity.org/mwiki/images/a/af/Set_Yourself_Free_Use_ODS_Report_Writing_Technology_PartI.pdf Second we will review SAS Program code that created the custom report discussed in Part II: SAS Code Revealed. Let’s Begin!
Highlights of Part I Introduction Data Application Each year Office Statewide Health Planning & Development publishes the California Report on Coronary Artery Bypass Graft (CABG) Surgery which includes quality of care performance ratings for 315 surgeons and 122 hospitals who perform heart surgery in California. The performance ratings are based on risk-adjusted operative mortality in a logistic regression model containing clinical risk factors. Clinical Risk factors include: all CABG surgeries; Status of Isolated and Non-Isolated CABG surgery; Resuscitation Prior to CABG Procedure; CABG surgery deaths; and six postoperative complications. CABG surgery performance ratings are intended for; cardiac patients and their families who are developing treatment plans with their doctors; hospitals and surgeons who are developing quality improvement activities; and organizations that purchase health care coverage for their members. Performance ratings for most surgeons and hospitals are “As Expected.” A few are “Better” and a few are “Worse.” The media will publish these results to praise or challenge the reputation of surgeons and hospitals. Oh My!
Highlights of Part I Introduction Need for Custom Report A Data Discrepancy Report (DDR) verifies the accuracy of risk-adjusted operative mortality used in the hospital and surgeon performance ratings. Hospitals are required to submit their data to a clinical data source called California CABG Outcome Reporting Program (CCORP), and an administrative data source called Patient Discharge Data (PDD). Differences in the value of the risk factor between these data sources must be reconciled by the hospital. It is important to ensure patient’s risk factors have the correct value so the hospital or surgeon receives the correct risk-adjusted weight for that hospitalization. Hospitals that handle more complex cases receive a larger risk-adjustment weight in the risk model, and hospitals that handle less complex cases receive a smaller weight. Thus hospitals and surgeons treating sicker patients are not at a disadvantage when their performance is compared with other hospitals or surgeons. This report identifies risk factor differences and assists hospital staff to review patient medical charts and verify that risk factor coding is consistent in both data sources.
Highlights of Part I Introduction Technical Challenge The previous report was created in MS Excel using Dynamic Data Exchange (DDE). Everyone loves a report in MS Excel because you can: investigate trends and differences using a large selection of colorful graphs, charts, and statistical analysis tools. However content and appearance of a report in MS Excel can be easily changed during review. We need a new custom report that is “easy to read” like MS Excel but also protects report content and appearance. However, the office is migrating to SAS Enterprise Guide which does not support Dynamic Data Exchange (DDE). So a new report must be created using SAS Enterprise Guide.
Highlights of Part I Introduction Compare Methods Dynamic Data Exchange (DDE) and Object Oriented Programming using a Data _Null_ are both powerful automation tools which read a data source and build a custom report without manually entering data or manually formatting individual tables thus saving time and reducing human error. However, writing code in DDE is very time consuming because it requires creating a template of instructions for each cell of each table in MS Excel. Also the dimensions of each table are limited to number of columns and rows of other tables on that worksheet. Object Oriented Programming allows you to position one or more tables on the page with ease. Also, locating a single page of a multi-sheet MS Excel report is difficult and printing the entire report is difficult. Object Oriented Programming creates a PDF file with bookmarks linked to specific report pages and printing this report is simple. Finally, a DDE report in MS Excel can be modified. An Object Oriented Programming report created as a PDF file in Adobe cannot be easily modified.
What the …. Can somebody tell me what Dr. Seuss stories these characters are from?
Part II: SAS Code Revealed Overview The remainder of this talk will focus on the ODS Report Writing Technology (Object Oriented Programming using a Data _Null_ ) that creates the custom report. The custom report contains two main sections Risk factor definitions (Display 1) Ten sections (risk factors or data variable discrepancies) each containing A summary page listing the number of records where there was a difference in the risk factor value between the two data sources (Display 2). A listing of hospital records identified on the summary page (Display 3). The handout contains this SAS program code. Let’s Begin!
Part II: SAS Code Revealed Setup Options and Create Reference Lists Handout Section 1: File Management Tasks (Lines 1-65) Lines 10-16 feature a PROC PRINTTO to collect all Warning and Note Messages contained in the “raw” SAS Job Log. Every time you execute an Object Oriented Programming statement, SAS inserts the message “WARNING: Data step interface is preproduction in this release” in the SAS Job Log so many times (several hundred thousand) that the resulting SAS Job Log does not serve any useful purpose. We will remove these messages and print a useful SAS Job Log at the end of my program. Other tasks include Removing special characters from a list of hospital names (Lines 27-35) . Creating a unique list of hospital license numbers and storing the list in macro &hosplist (Lines 48-55). Creating a unique list of hospital names and storing the list in macro &qhosplist (Lines 57-64).
Display 1. Data Discrepancy Variable Help Instructions
Part II: SAS Code Revealed Let’s Create Display 1 Handout Section 2: Compile macro %HelpSheet (Lines 66-106) The macro %HelpSheet will create the first page of the custom report which consists of a list of risk factors or data discrepancy variable definitions (Display 1). Lines 83-104 is our first example of using Object Oriented Program statements in a DATA _NULL_ Step. This code creates two columns of printed text where the first row is highlighted in yellow. Note the following statements. dcl odsout obj() to begin a new table definition. obj.layout_gridded to define number of columns and justification for entire table. obj.region to define column width for current column. obj.format_text to insert text or a data value. overrides to specify format properties applied to text and data values. Other tasks include Creating a title and footnote (Lines 70-76). Using statement “ods proclabel” to create a PDF bookmark link “DEFINITIONS FOR EACH DDR VARIABLE” (Line 78).
Display 2. Summary Sheet for Each of Ten Data Variable Discrepancy Sections.
Part II: SAS Code Revealed Let’s Create Display 2 Handout Section 3: Compile macro %DDRVarSection (107-171) This macro will create the summary page for each of ten risk factors (data discrepancy variables) (sections). The summary page (Display 2) identifies instances where the risk factor shows a difference between the clinical data source (CCORP) and the administrative data source (PDD). These differences are defined as either “under-reporting records” (CCORP=“N”; PDD=“Y”), or “over reporting records” (CCORP=“Y”; PDD=“N”). Lines 120-170 feature a DATA _Null_ with the _N_ system variable which controls how data is read from two data set (&dataname1., &dataname2., ) and four variables (notevar, notedescrip, &sumunder., &sumover) and displayed in each of row of the summary table. The _N_ system variable is needed because different data sets and different variables are used to fill information in each table cell. Maybe someone can show me how to do this with macro look-up tables? Again note the use of statements obj.table_start(), obj.row_start(), obj.format_cell(), overrides, obj.row_end(), and obj.table_end to define each column of each row of the summary table. Other tasks include creating a different PDF bookmark title for each of ten summary pages (Line 119).
Display 3. Patient Level Data for Each of Ten Data Variable Discrepancy Sections.
Part II: SAS Code Revealed Let’s Create Display 3 Handout Section 4: Compile macro %DDRVarSection (Lines 172-350) This macro will also create a list of patient hospitalization records for each of ten risk factors (sections) (Display 3). Lines 194-225 generates three pieces of information to help hospitals track down the medical record in question. The “CASE #” identifies under-reporting or over-reporting cases. The “CABG TYPE” identifies either Isolated CABG or Non-Isolated CABG. The “DATABASE LINKAGE” identifies if the hospital record was found in both data sources. Lines 227-270 adds four rows to this table containing eight additional patient identifiers of medical record number, social security number, sex, birth date, surgery date, discharge date, death date, and surgeon name. Lines 272-332 creates a new table for patient diagnosis and procedure information that is contained in the PDD. Remember these risk factors are identified in the administrative data (PDD) using a complex recipe of diagnosis and procedure ICD-9CM information. CCORP clinical data for CABG is simply “Yes” or “No.” PDD data for CABG does not include procedure “36.1” Hence the case is “over-reported.”
Part II: SAS Code Revealed Let’s Create the Custom Report Handout Section 5: Run the Report for Each Hospital (Lines 352-446). Lines 354-411 compiles macro %hospitalddr which includes one call to macro %helpsheet which creates the first page of risk factor definitions (Display 1), and ten calls to macro %ddrvarsection which creates the summary page and a list of hospital records for each risk factor (Displays 2-3). Note we have a global macro variable named &hospitalnum which selects a specific hospital that is shared between macro %hospitalddr (line 362), macro %helpsheet (line 366), and each occurrence of macro %ddrvarsection (370). This will ensure the custom report only contains information for the same hospital. Lines 413-423 create another macro %callddr which reads our list of hospital license numbers and names and executes the macro %hospitalddr for each hospital on that list. The macro function %sysfunc creates a dynamic list of hospital license number and names. The macro function %scan reads each list and selects both the hospital number and name which is then passed to the macro %hospitalddr. Lines 430-446 reads the “raw” SAS Job Log (filename ddr_log) and removes all occurrences of the text string “WARNING: DATA step interface is preproduction in this release” to create a revised SAS Job Log for our viewing pleasure.
You did a great job, give your self a hand. What Dr You did a great job, give your self a hand !! What Dr. Seuss stories are these characters are from? Who knows which story was not written by Dr. Seuss?
Conclusion Acknowledgements In today’s sophisticated business environment where the ability to prepare custom designed reports and convey your message in a clear and concise manner is an absolute imperative; and many organizations are transitioning to SAS Enterprise Guide for their data collection, analytics, and data reporting needs; ODS Report Writing technology using SAS Enterprise Guide is an powerful alternative to Dynamic Data Exchange (DDE) using PC SAS. Acknowledgements I want to acknowledge Dan O’Connor for creating this technology, Art Carpenter for showing me how to build nested macros and executing the report for each hospital in a macro list, and Susan Slaughter for telling me to “get off the couch” and submit this talk to SAS Global Forum. Also to Bob Bolen and Zul Habib for inviting me to present this paper at SAS Global Forum.
Thanks for Your Attention Your comments and questions are valued and encouraged. Contact the author at: Robert Richard Springborn, Ph.D. Healthcare Outcomes Center, OSHPD Office of Statewide Health Planning and Development 400 R Street, Suite 250 Sacramento, CA 95811-6213 Office (916) 326- 3874 Robert.Springborn@oshpd.ca.gov The presentation and handouts can be found at http://www.sascommunity.org/wiki/Set_Yourself_Free_%E2%80%93Use_ODS_Report_Writing_Technology _in_SAS_Enterprise_Guide_Instead_of_Dynamic_Data_Exchange_in_PC_SAS