Presentation is loading. Please wait.

Presentation is loading. Please wait.

Never Cut and Paste Again

Similar presentations


Presentation on theme: "Never Cut and Paste Again"— Presentation transcript:

1 Never Cut and Paste Again
How to Automate Results with ODS PowerPoint, Metadata and Macros

2 What’s the Problem? SAS creates dataset, reports, charts, etc.
Clients (internal and external) want presentations Clients always want report re-run Cutting, pasting, and re-formatting is: Time consuming Error prone Boring…

3 Learning Objectives Create PowerPoint® files using the SAS® PowerPoint ODS Create macros to automatically calculate descriptive statistics on all variables in a dataset using the DICTIONARY.COLUMNS dataset Send reporting elements (tables and chart) to PowerPoint presentation files

4 Outline Healthcare claims data structures
Create fact tables from healthcare data Create results table with descriptive statistics Create PowerPoint file Create tables in PowerPoint using PROC REPORT Create charts in PowerPoint using PROC SGPLOT

5 What’s In, What’s Out Conference white paper has a step-by-step walkthrough of all of the code Presentation will touch on the key concepts and syntax

6 Healthcare Data Structures
Paid bills (aka administrative claims data) Transactional data One observation per claim Disparate dataset Pharmacy Claims (e.g. paid bills for prescriptions) Medical Claims (e.g. paid bills for hospital stay)

7 Create Fact Table From Healthcare Data
Commonly used in data warehouses Create a single observation per entity (patient) Add study measures Total paid Total Claims etc.

8 Create Fact Table From Healthcare Data
PROC SQL; CREATE TABLE Fact AS SELECT PatientID, DateOfBirth , Gender FROM Medical UNION SELECT FROM Pharmacy ; QUIT;

9 Limitations of Variable Names
Too Short (32 characters) Limited Character Set (no spaces, leading number, etc.) e.g. Baseline Allowed Amount Per Member Per Month for Inpatient Hospitalizations Due to Chronic Obstructive Pulmonary Disease becomes BaseAAPMPMInptHospCOPD

10 Variable Label Property
256 Characters Larger character set DATA Fact; SET Fact; ATTRIB DateOfBirth LABEL = "Date Of Birth" ; RUN;

11 Overloading the Variable Name
Overloading the variable name with a prefix BASE_ for Baseline data FLUP_ for Follow Up data Used by macro to identify reportable values

12 Study Measure Macros Builds a reusable library
%Macro AssignRxCount(Dataset=); *Create Variable with a Label; DATA &Dataset; SET &Dataset; ATTRIB FLUP_RxCount LENGTH = 8 FORMAT = COMMA9. LABEL = "Total Number of Prescriptions"; RUN; *Populate the Fact table value; PROC SQL; UPDATE &Dataset f SET FLUP_RxCount = ( SELECT COUNT(AmountPaid) FROM Pharmacy p WHERE p.PatientID = f.PatientID); QUIT; %mend; Builds a reusable library Couples the variable creation and population Iterate through the measures

13 Completed Fact Table

14 Iterate Through Metadata
proc sql ; SELECT Name, Type INTO :MeasureVariable1-MeasureVariable9999, :MeasureType1-:MeasureType9999 FROM DICTIONARY.Columns WHERE LibName = "&FactLib" and MemName = "&FactDS" AND (Name like"BASE%" or Name like"FLUP%") ; quit; %let MeasureCounter = &SqlObs; %DO ctr = 1 %to &MeasureCounter; … %END DICTIONARY.COLUMNS contains every variable in every dataset in every library Load each variable name and type into an array Loop through the array and summarize the data

15 Summarize Based on Data Type
%IF &&MeasureType&ctr = char %then %do; %AddCategoricalResults( Library=&FactLib, Dataset=&FactDS, Variable=&&MeasureVariable&ctr ); %end; %else %if &&MeasureType&ctr = num %then %AddContinuousResults( Call a different summarizing macro based on the data type char data = #(%) num data = Mean(median)[SD]

16 Results Table

17 Advantages of Results Table
PowerPoint generation is independent of fact table variables Everything needed is in the results table Results formatting is completed, no need to check metadata All project-specific data structures have been translated into a standard format

18 Create PowerPoint file
Two statements are minimum Any PROC sending data to the results window will send results to PowerPoint …but the devil is in the details… ODS PowerPoint ; /* Any PROC sending output to the results window */ ODS PowerPoint Close;

19 PowerPoint ODS Lessons Learned
FILE = <Any Valid File Path> LAYOUT=TitleAndContent OPTIONS PAPERSIZE=(10in 5.63in) Control other style properties in PROCs vs. PowerPoint ODS Wide PowerPoint Tables => Control width with font size

20 Output Results with Data Type Specific Macros
Create a separate macros for Numeric Character Can be expanded to consider Format Currency Dates pValue Nominal vs. Ordinal Distribution

21 White Paper Code Output Sample

22 White Paper Code Output Sample

23 Sample from Magellan Method
Different colored header section Banded rows Custom column headers with population sizes Bolded rows for significant p values

24 Conclusions Variable labels, formats and overloaded variable names can be used by macros to automate descriptive statistics for dozens, even thousands of measures ODS PowerPoint can be used to send the results of any PROC to a PowerPoint file Tables with PROC REPORT or PROC TABULATE Charts with PROC SGPLOT

25 Contact Information Name: Ted D. Williams, PharmD, BCPS Company: Magellan Method City/State: Middletown, RI Phone:


Download ppt "Never Cut and Paste Again"

Similar presentations


Ads by Google