Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "DIVERSE REPORT GENERATION By Chris Speck PAREXEL International Durham, NC."— Presentation transcript:

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

2 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

3 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

4 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

5 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

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

7 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

8 Macro Call Example Note that parameters and their values are arbitrary

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

10 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

11 Step 1: Subset Data The Code:

12 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

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

14 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

15 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

16 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

17 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

18 Step 3: Capturing Metadata The Code:

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

20 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?

21 Step 4: Building DEFINE Statements The Code:

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

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

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

25 Step 5: Produce Reports The Code:

26 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

27 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?

28 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

29 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

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


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

Similar presentations


Ads by Google