DIVERSE REPORT GENERATION By Chris Speck PAREXEL International Durham, NC.

Slides:



Advertisements
Similar presentations
ADaM Implementation Guide: It’s Almost Here. Are You Ready?
Advertisements

Creating Data Entry Screens in Epi Info
Haas MFE SAS Workshop Lecture 3:
Microsoft ® Office Excel ® 2007 Training Get started with PivotTable ® reports Sweetwater ISD presents:
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Outline Proc Report Tricks Kelley Weston. Outline Examples 1.Text that spans columnsText that spans columns 2.Patient-level detail in the titlesPatient-level.
Creating a Compact Columnar Output with PROC REPORT Walter R. Young Principal Clinical Programmer Analyst Wyeth.
SAS Programming Techniques for Decoding Variables on the Database Level By Chris Speck PAREXEL International RTSUG – Wednesday, March 23, 2011.
Psychology 202b Advanced Psychological Statistics, II February 22, 2011.
Introduction to SQL Session 2 Retrieving Data From Multiple Tables.
Introduction to SQL Session 1 Retrieving Data From a Single Table.
Jeremy W. Poling B&W Y-12 L.L.C. Can’t Decide Whether to Use a DATA Step or PROC SQL? You Can Have It Both Ways with the SQL Function!
Let SAS Do the Coding for You! Robert Williams Business Info Analyst Sr. WellPoint Inc.
Chapter 18: Modifying SAS Data Sets and Tracking Changes 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
How to Build Tabular Dashboards Using Proc Report
Data Preparation for Analytics Using SAS Gerhard Svolba, Ph.D. Reviewed by Madera Ebby, Ph.D.
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
Get started with PivotTable reports Make your data work for you Imagine an Excel worksheet of sales figures. It lays out thousands of rows of data about.
“SAS macros are just text substitution!” “ARRRRGGHHH!!!”
I OWA S TATE U NIVERSITY Department of Animal Science Writing Flexible Codes with the SAS Macro Facility (Chapter in the 7 Little SAS Book) Animal Science.
Fruitful functions. Return values The built-in functions we have used, such as abs, pow, int, max, and range, have produced results. Calling each of these.
SAS PROC REPORT PROC TABULATE
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
Financial Statement Modeling & Spreadsheet Engineering “Training in spreadsheet modeling improves both the efficiency and effectiveness with which analysts.
HS 115 Unit Four Seminar Amber Krasny, MBA, CPC, CMRS.
EGR 2261 Unit 5 Control Structures II: Repetition  Read Malik, Chapter 5.  Homework #5 and Lab #5 due next week.  Quiz next week.
 2004 Prentice Hall, Inc. All rights reserved. 1 Chapter 11 - JavaScript: Arrays Outline 11.1 Introduction 11.2 Arrays 11.3 Declaring and Allocating Arrays.
Introduction to SAS Essentials Mastering SAS for Data Analytics
HPR Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
Introduction to SAS. What is SAS? SAS originally stood for “Statistical Analysis System”. SAS is a computer software system that provides all the tools.
Report Management Using the ODS DOCUMENT Destination and Report Metadata Brit Harvey February 2010.
My ODS: Real-World Uses of Modifying Table Templates Steve James Centers for Disease Control and Prevention Atlanta, Ga.
INTRODUCTION TO SAS MACRO PROCESSING James R. Bence, Ph.D., Co-Director Quantitative Fisheries Center Professor Department of Fisheries and Wildlife March.
SAS Efficiency Techniques and Methods By Kelley Weston Sr. Statistical Programmer Quintiles.
Java Script: Arrays (Chapter 11 in [2]). 2 Outline Introduction Introduction Arrays Arrays Declaring and Allocating Arrays Declaring and Allocating Arrays.
Word 2013 Certification Skills Measured. 1. Create and Manage Documents  Create a Document  Navigate through a Document  Format a Document  Customize.
SQL Chapter Two. Overview Basic Structure Verifying Statements Specifying Columns Specifying Rows.
SESSION 3.1 This section covers using the query window in design view to create a query and sorting & filtering data while in a datasheet view. Microsoft.
Introduction to Enterprise Guide Jennifer Schmidt Rhonda Ellis Cassandra Hall.
1 Data Manipulation (with SQL) HRP223 – 2010 October 13, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
1 Using the Magical Keyword “INTO” in PROC SQL Thiru Satchi Blue Cross and Blue Shield of Massachusetts Boston Area SAS Users Group April 5, 1999.
O FFICE M ANAGEMENT T OOL - II B BA -V I TH. Abdus Salam2 Week-7 Introduction to Query Introduction to Query Querying from Multiple Tables Querying from.
Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
1 Statistical Software Programming. STAT 6360 –Statistical Software Programming Modifying and Combining Datasets For most tasks we need to work with multiple.
Customize SAS Output Using ODS Joan Dong. The Output Delivery System (ODS) gives you greater flexibility in generating, storing, and reproducing SAS procedure.
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
For a programming more efficient Claude Guyot PhUSE 2010 – Berlin Paper CS05.
Chapter 21: Controlling Data Storage Space 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
XP Tutorial 3 New Perspectives on JavaScript, Comprehensive1 Working with Arrays, Loops, and Conditional Statements Creating a Monthly Calendar.
BMTRY 789 Lecture9: Proc Tabulate Readings – Chapter 11 & Selected SUGI Reading Lab Problems , 11.2 Homework Due Next Week– HW6.
Chapter 6: Modifying and Combining Data Sets  The SET statement is a powerful statement in the DATA step DATA newdatasetname; SET olddatasetname;.. run;
Foundations of Software Testing Chapter 5: Test Selection, Minimization, and Prioritization for Regression Testing Last update: September 3, 2007 These.
Online Programming| Online Training| Real Time Projects | Certifications |Online Classes| Corporate Training |Jobs| CONTACT US: STANSYS SOFTWARE SOLUTIONS.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 14 & 19 By Tasha Chapman, Oregon Health Authority.
Working Efficiently with Large SAS® Datasets Vishal Jain Senior Programmer.
Build your Metadata with PROC CONTENTS and ODS OUTPUT Louise S. Hadden Abt Associates Inc.
John Lloyd, Edgewater Fullscope
More SQL: Complex Queries, Triggers, Views, and Schema Modification
Session 1 Retrieving Data From a Single Table
Chapter 11 - JavaScript: Arrays
Chapter 6: Modifying and Combining Data Sets
Dynamic SQL: Writing Efficient Queries on the Fly
Dynamic SQL: Writing Efficient Queries on the Fly
Beautiful PROC CONTENTS Output Using the ODS Excel Destination
3 Iterative Processing.
Bring the Vampire out of the Shadows: Understanding the RETAIN and COUNT functions in SAS® Steve Black.
Never Cut and Paste Again
Introduction to SAS Essentials Mastering SAS for Data Analytics
Presentation transcript:

DIVERSE REPORT GENERATION By Chris Speck PAREXEL International Durham, NC

Introduction Diverse Report Generation (DRG) – A dynamic way to produce listings or patient profiles – A new way of thinking about report generation DRG Goals – Automation of large reporting jobs in one macro with minimal code – Synthesis of multiple and disparate datasets – 1-step updates for adding or removing outputs – Easy portability between projects – Potential for expansion of capabilities

Alternative Ways of Reporting Suppose we need to produce patient profile documents with data from 4 datasets. Intuitive: Loop through a macro using Brute Force – Difficult to edit, especially for large jobs – Difficult to transport across studies – Prone to bugs

Alternative Ways of Reporting Loop through a macro using macro logic – Same difficulties as previous example PROC REPORT Data=ADMH PROC REPORT Data=ADAE YES NO LISTING MACRO USING MACRO LOGIC Get/Derive dataset List More datasets ? ADMH? YES NO ADAE ? YES NO PROC REPORT Data=ADVS ADVS ? YES ADEG ? YES NO PROC REPORT Data=ADEG

DRG Method of Reporting Call %MakeReport macro which has only one PROC REPORT and writes code at run time To update program, need only to add new macro calls not new PROC REPORTS YES NO PATIENT PROFILES MACRO USING DRG Get/Derive Patient List More Patients ? MAKE REPORT MACRO %MakeReport Macro Call: ADMH %MakeReport Macro Call: ADAE %MakeReport Macro Call: ADVS %MakeReport Macro Call: ADEG

DRG Method of Reporting How can DRG possibly do this: – with only one PROC REPORT? – while avoiding lengthy macro logic? – With datasets having differing numbers of variables? Column statements would differ across datasets. The number of define statements would differ across datasets. The width of columns would be different for each dataset.

DRG Method of Reporting Five steps: 1.Subsetting data 2.Adding blank observation to datasets if necessary 3.Capturing metadata (variables, labels) from SASHELP.VTABLE 4.Building DEFINE statements into a PROC SQL macro variable 5.Inserting DEFINE macro variable into PROC REPORT PARAMETERS – Dataset name – Variable list – Where statement – Column widths – Autofit flag – Titles and headers

Macro Call Example Note that parameters and their values are arbitrary

Macro Call Example Note that parameters and their values are arbitrary Part of Patient List mentioned on Slides 3 and 4 Optional Parameters

Steps 1-3 Establish macro variables – &DEFINE becomes PROC REPORT define statements – &EMPTY tells PROC REPORT if any observations met the WHERE criteria. Default is N. – &LS resolves to Line Size. For this example, &LS=125. Subset data with WHERE parameter Insert blank observation if dataset is empty – &EMPTY is assigned here. Y if no observations meet WHERE criteria

Step 1: Subset Data The Code:

Step 1: Subset Data The Code: Common sense dataset suffix Keep only variables parameter list RETAIN sorts variables according to parameter list WHERE parameter subsets data

Step 2: Insert Blank Row Insert empty observation into &DS.RPT0 if dataset is empty so PROC REPORT can read it.

Step 2: Insert Blank Row Insert empty observation into &DS.RPT0 if dataset is empty so PROC REPORT can read it. Temporary variable equal to number of observations

Step 2: Insert Blank Row Insert empty observation into &DS.RPT0 if dataset is empty so PROC REPORT can read it. Takes us to MODIFY with no change Temporary variable equal to number of observations

Step 2: Insert Blank Row Insert empty observation into &DS.RPT0 if dataset is empty so PROC REPORT can read it. Takes us to MODIFY with no change Takes us to MODIFY with changes Temporary variable equal to number of observations

Step 2: Insert Blank Row Insert empty observation into &DS.RPT0 if dataset is empty so PROC REPORT can read it. Takes us to MODIFY with no change Takes us to MODIFY with changes Modifies dataset without having to read it into the PDV. Hence no SET statement Temporary variable equal to number of observations

Step 3: Capturing Metadata The Code:

Step 3: Capturing Metadata The Code: Macro logic used because WIDTH and AUTOFIT are optional

Step 3: Capturing Metadata &DS.RPT1 should look something like this: NAMELABELWIDTH MHCATCategory for Medical History20 MHTERM Reported Term for Medical History 30 MHPTT Preferred Term for Medical History 30 MHSTDATStart Date20 MHONGOOngoing?10 What was horizontal is now vertical What would WIDTH be if AUTOFIT=Y?

Step 4: Building DEFINE Statements The Code:

Step 4: Building DEFINE Statements The Code: Using SELECT and INTO to build macro variable called DEFINE. This becomes PROC REPORT code. Semi-colon ends each SAS statement.

Step 4: Building DEFINE Statements The Code if using ODS RTF: Use STYLE statements and percents instead of absolute widths

Step 4: Building DEFINE Statements &DEFINE should ultimately look something like this:

Step 5: Produce Reports The Code:

Step 5: Produce Reports The Code: Inserting variable list, title and header parameters Inserting &DEFINE macro variable as PROC REPORT code Using &EMPTY to provide notice if no observations match WHERE criteria

Error Checking Examples Do datasets and variables exist? Do number of values in WIDTHS and VARS parameters match? Is sum of WIDTH values and appropriate spacing values ≤ &LS? Are WIDTHS and AUTOFIT parameters populated at the same time?

Final Thoughts on DRG Datasets must be pre-programmed, sorted, and ready for reporting Best for profile, listing, or similar reporting in which data has little treatment in PROC REPORT Not best approach if using complex COMPUTE blocks or PROC REPORT to alter data BY, GROUP, ORDER, and BREAK statements can be introduced through additional parameters

Conclusion DRG is an alternative brute force and macro logic automation DRG allows for shorter programming times, more elegant and transportable code By having SAS write code for us, DRG is an effective way to utilize the power of SAS

CONTACT INFORMATION Chris Speck Principal Programmer PAREXEL International, Durham, NC