Download presentation
Presentation is loading. Please wait.
Published byAlexis Welch Modified over 8 years ago
1
Programming the Provider Previews: Extreme SAS® Reporting Louise S. Hadden, Lead Programmer Analyst, Abt Associates Inc. Presented to CMS, October 17, 2011
2
Abt Associates | pg 2 Background The U.S. Centers for Medicare and Medicaid Services (CMS) maintains a Nursing Home Compare website CMS added a 5 star rating system in December 2008 Ratings on 3 quality domains (plus some additional information) are refreshed monthly Previews of the month’s ratings for each of 17,500+ providers are automatically generated in a single SAS® program
3
Abt Associates | pg 3 Anatomy of the Program A full copy of a recent version of the program is available upon request Program Header Macro Variables Test and Production Provider Rating Files Create Macro Routines Conditional Execution of Macro Routines
4
Abt Associates | pg 4 Sample Provider Preview Page
5
Abt Associates | pg 5 Behind the Scenes In order to create the effect of a personalized letter for each provider, we need to remove the cell borders present in most SAS output. We use PROC TEMPLATE to create a “noborder” style template. /* the noborder template */ proc template; define style styles.noborder; parent=styles.minimal; style Table / rules = NONE frame = VOID cellpadding = 0 cellspacing = 0 borderwidth = 0; end; run;
6
Abt Associates | pg 6 Behind the Scenes We will want cell borders in tables in the provider previews. SAS and ODS allow you to change styles within your ODS call. Set or reset the style template prior to a procedure you want to be output with a particular style. /* reset style */ ods pdf style=styles.noborder;... /* reset style */ ods pdf style=styles.minimal;
7
Abt Associates | pg 7 Creating “Paragraphs” in SAS It is possible to create very wide variables in SAS® using a data step and the CAT functions OR you can import and use a file with very wide variables Label variables with the “Hidden Dragon” or a null to suppress “printing” of label / variable name Use ODS inline style change commands to change text attributes in paragraphs Use special ODS functions to create line feeds, etc. within paragraphs
8
Abt Associates | pg 8 Creating “Paragraphs” in SAS
9
Abt Associates | pg 9 Using Macro Variables We use data-driven macro variables to insert provider-specific information in the previews. We also determine the length of each macro variable Our hero is CALL SYMPUT /* create provider specific macro variables */ data len; set provider_preview (where=(provnum="&provnum")); enum1=put(incident_cnt,comma9.); lenum1=length(strip(enum1)); call symput('lenum1',lenum1);... run;
10
Abt Associates | pg 10 Using Macro Variables We also use macro variables to set file dates, create file names, and toggle between test and production mode. These macro variables are not data-driven. These variables are set at the top of the program, and are identical to those used in programs throughout the monthly processing Our hero in this case is the %LET statement /* set dates for current round of processing */ %let filedate=0602; %let fileyear=2011; %let runmode=production; /* alternatives are test and production - case matters */ %let reportno=31; /* 31 is for June 2011 */
11
Abt Associates | pg 11 Including Graphics (Logo) We wanted to insert the CMS logo on the first page of the provider preview There are a number of options including ODS text fields with a pre/postimage style command, title and/or footnote statements, and a custom style template. We used ODS text. An example of this usage, placed after the ODS call but before any other ODS text fields or procedures, follows. ods text='^S={preimage="cmslogo.tif"}';
12
Abt Associates | pg 12 Including Graphics (Unicode) We use SAS Unicode characters to produce the ratings stars in the previews. Unicode characters are available in SAS 9.2 and above. We created a format containing 1-5 stars depending on the providers’ ratings Character variables representing the star versions of the ratings were constructed using put statements and the star format. These character variables were used in a PROC REPORT to produce a table with stars.
13
Abt Associates | pg 13 Including Graphics (Unicode) Creating a format with Unicode characters PROC FORMAT; VALUE $STARFMT '10'='^{UNICODE 2605}' '20'='^{UNICODE 2605}^{UNICODE 2605}'... '70'='TOO NEW TO RATE' '90'='DATA NOT AVAILABLE'; RUN;
14
Abt Associates | pg 14 Including Graphics (Unicode) CONSTRUCTING THE CHARACTER VARIABLES CONTAINING UNICODE STARS DATA RPTLINE; LENGTH COL1 COL2 COL3 COL4 COL5 COL1A COL2A COL3A COL4A COL5A $ 200; SET PROVIDER_PREVIEW (WHERE=(PROVNUM="&PROVNUM")); COL1A=PUT(OVERALL_RATING,$STARFMT.);... IF OVERALL_RATING IN('10','20','30','40','50') THEN COL1=COL1A; IF OVERALL_RATING IN('70','90') THEN COL1=CATT('^{STYLE [FONTSIZE=11PT]',COL1A,'}');... RUN;
15
Abt Associates | pg 15 Including Graphics (Unicode) PROC REPORT USING THE STAR RATING VARIABLES PROC REPORT NOWD DATA=RPTLINE /* SPACING=8 */ STYLE(REPORT)=[CELLPADDING=3PT VJUST=B] STYLE(HEADER)=[JUST=CENTER FONT_FACE=ARIAL FONT_WEIGHT=BOLD FONT_SIZE=10PT] STYLE(LINES)=[JUST=LEFT FONT_FACE=ARIAL] SPLIT='|'; COLUMNS ("RATINGS FOR ^S={JUST=C FONT_SIZE=10PT FONT_FACE=ARIAL COLOR=BLUE}&PNAME. &PARENFAC.^N&PROVCITY" COL1 COL2 COL3 COL4 COL5); DEFINE COL1 / STYLE(COLUMN)={JUST=C FONT_FACE=ARIAL FOREGROUND=BLUE FONT_SIZE=12PT CELLWIDTH=170 } STYLE(HEADER)={JUST=C FONT_FACE=ARIAL FONT_WEIGHT=BOLD FONT_SIZE=10PT };... RUN;
16
Abt Associates | pg 16 Including Graphics (Unicode) To look up Unicode values on a Windows system, open Start ->Programs ->Accessories ->System Tools ->Character Map.
17
Abt Associates | pg 17 Printing Pages with Multiple Procedure Calls Constructing “pages” in SAS is a challenge, for a number of reasons. ODS RTF and ODS PDF both provide the ODS STARTPAGE command. The default is to start a new page for each procedure. ODS STARTPAGE=NO overrides the default. Similarly, ODS STARTPAGE=YES starts a new page.
18
Abt Associates | pg 18 Printing Pages with Multiple Procedure Calls ods pdf startpage=no; ods text='^S={preimage="cmslogo.tif"}';... ods pdf startpage=no; proc report nowd data=rptline... ods pdf startpage=no; proc report nowd data=page1... run; ods pdf startpage=yes; proc report nowd data=page2... A very large caveat is that SAS will not “break” a “paragraph” (in this case, a paragraph is really a very wide single variable so this makes sense.
19
Abt Associates | pg 19 Efficiencies using Macro Processing and PROC SQL Frequent changes in the provider previews means we needed to build in as much flexibility into the program as possible. Need to run in test mode each month Following review of test, run in production mode Different routines for test and production mode are conditionally executed based on a macro variable (RUNMODE) set at the top of the program.
20
Abt Associates | pg 20 Efficiencies using Macro Processing and PROC SQL The main reporting macro is RPTMAC. 15 providers in test mode and all 17,500+ providers in production mode need to be fed into RPTMAC each month. The group of providers is fluid, and changes each month. We used PROC SQL to accomplish the hard work of creating 17,500+ macro calls. The driver macro shown on the next page is a simple and elegant solution to the challenge (much gratitude to SAS-L.)
21
Abt Associates | pg 21 Efficiencies using Macro Processing and PROC SQL The input file “finder” is conditionally created using a macro MAKEFIND which takes as a parameter an input file (either a test file of 15 providers or the full provider rating file) %macro driver ; proc sql noprint ; select provnum into :eid1-:eid999999 from finder; %let num_entities = &SQLOBS ; quit ; %do i = 1 %to &num_entities ; %let this_entity = &&eid&i ; %rptmac(&this_entity) ; %end ; %mend driver ;
22
Abt Associates | pg 22 Managing File Sizes The source files used for the provider previews are relatively small However, 15,700+ PDFs per month are not –Inline style commands take up space –Certain fonts take up more space than others –Sheer volume takes up space We use ODS PDF compression to reduce file sizes We use X window and WINZIP CLI within the SAS program to zip up previews after generating
23
Abt Associates | pg 23 The Future of the Provider Previews ODS Layout is pre-production in the current version of SAS and holds great promise in its design capacity and maybe even help with pagination issues SAS tools described in the process of creating the provider previews are still relevant –Ability to construct paragraphs –Ability to issue inline style commands –Ability to take advantage of ODS functions –Ability to manage file sizes –Ability to execute code conditionally –Ability to take advantage of PROC SQL and macro processing efficiencies
24
Abt Associates | pg 24 Acknowledgements Scott Huntley, Dan O’Connell and Cynthia Zender of SAS Contributions to the Nursing Home Compare project by: –Abt Associates: Christianna Williams, Allison Muma, Alan White and Mike Plotzke –CMS: Edward Mortimore, Frank Nagy, Jenny Filopovits, and Thomas Kress SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. Other brand and product names are trademarks of their respective companies.
25
Abt Associates | pg 25 Contact Information Louise S. Hadden Abt Associates Inc. 55 Wheeler St. Cambridge, MA 02138 Louise_Hadden@Abtassoc.com
26
Questions, Comments or Suggestions?
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.