Post Processing Macro in Clinical Data Reporting Niraj J. Pandya



Similar documents
SUGI 29 Data Presentation

Using Pharmacovigilance Reporting System to Generate Ad-hoc Reports

Paper Hot Links: Creating Embedded URLs using ODS Jonathan Squire, C 2 RA (Cambridge Clinical Research Associates), Andover, MA

Using Macros to Automate SAS Processing Kari Richardson, SAS Institute, Cary, NC Eric Rossland, SAS Institute, Dallas, TX

ing Automated Notification of Errors in a Batch SAS Program Julie Kilburn, City of Hope, Duarte, CA Rebecca Ottesen, City of Hope, Duarte, CA

Report Customization Using PROC REPORT Procedure Shruthi Amruthnath, EPITEC, INC., Southfield, MI

Perfecting Report Output to RTF Steven Feder, Federal Reserve Board, Washington, D.C.

How To Write A Clinical Trial In Sas

Essential Project Management Reports in Clinical Development Nalin Tikoo, BioMarin Pharmaceutical Inc., Novato, CA

A Macro to Create Data Definition Documents

PharmaSUG Paper AD11

One problem > Multiple solutions; various ways of removing duplicates from dataset using SAS Jaya Dhillon, Louisiana State University

OS/390 SAS/MXG Computer Performance Reports in HTML Format

We begin by defining a few user-supplied parameters, to make the code transferable between various projects.

SAS Macros as File Management Utility Programs

A Method for Cleaning Clinical Trial Analysis Data Sets

Remove Voided Claims for Insurance Data Qiling Shi

AN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike S. Zdeb, New York State Department of Health

Utilizing Clinical SAS Report Templates with ODS Sunil Kumar Gupta, Gupta Programming, Simi Valley, CA

Methodologies for Converting Microsoft Excel Spreadsheets to SAS datasets

Choosing the Best Method to Create an Excel Report Romain Miralles, Clinovo, Sunnyvale, CA

Same Data Different Attributes: Cloning Issues with Data Sets Brian Varney, Experis Business Analytics, Portage, MI

An Approach to Creating Archives That Minimizes Storage Requirements

Let SAS Modify Your Excel File Nelson Lee, Genentech, South San Francisco, CA

More Tales from the Help Desk: Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board

4 Other useful features on the course web page. 5 Accessing SAS

Optimizing System Performance by Monitoring UNIX Server with SAS

SAS ODS HTML + PROC Report = Fantastic Output Girish K. Narayandas, OptumInsight, Eden Prairie, MN

An Introduction to SAS/SHARE, By Example

You have got SASMAIL!

Introduction to SAS Business Intelligence/Enterprise Guide Alex Dmitrienko, Ph.D., Eli Lilly and Company, Indianapolis, IN

PharmaSUG 2014 Paper CC23. Need to Review or Deliver Outputs on a Rolling Basis? Just Apply the Filter! Tom Santopoli, Accenture, Berwyn, PA

Preparing Real World Data in Excel Sheets for Statistical Analysis

ABSTRACT INTRODUCTION %CODE MACRO DEFINITION

Innovative Techniques and Tools to Detect Data Quality Problems

Creating Word Tables using PROC REPORT and ODS RTF

Search and Replace in SAS Data Sets thru GUI

Switching from PC SAS to SAS Enterprise Guide Zhengxin (Cindy) Yang, inventiv Health Clinical, Princeton, NJ

SUGI 29 Coders' Corner

OBJECT_EXIST: A Macro to Check if a Specified Object Exists Jim Johnson, Independent Consultant, North Wales, PA

Importing Excel File using Microsoft Access in SAS Ajay Gupta, PPD Inc, Morrisville, NC

Instant Interactive SAS Log Window Analyzer

SQL SUBQUERIES: Usage in Clinical Programming. Pavan Vemuri, PPD, Morrisville, NC

Developing an On-Demand Web Report Platform Using Stored Processes and SAS Web Application Server

Automated distribution of SAS results Jacques Pagé, Les Services Conseils HARDY, Quebec, Qc

From The Little SAS Book, Fifth Edition. Full book available for purchase here.

Training/Internship Brochure Advanced Clinical SAS Programming Full Time 6 months Program

Microsoft Word 2010 Mail Merge (Level 3)

Smart Web. User Guide. Amcom Software, Inc.

Labels, Labels, and More Labels Stephanie R. Thompson, Rochester Institute of Technology, Rochester, NY

Macros from Beginning to Mend A Simple and Practical Approach to the SAS Macro Facility

Hands-On Workshops HW003

ClinPlus. Report. Technology Consulting Outsourcing. Create high-quality statistical tables and listings. An industry-proven authoring tool

Lesson 07: MS ACCESS - Handout. Introduction to database (30 mins)

A Quick and Dirty Method for Delivering SAS Reports Via the World Wide Web

The rcs Package. Joachim Schrod. August 2, 1995 (Revision 2.10 of rcs.sty)

Data Presentation. Paper Using SAS Macros to Create Automated Excel Reports Containing Tables, Charts and Graphs

SENDING S IN SAS TO FACILITATE CLINICAL TRIAL. Frank Fan, Clinovo, Sunnyvale CA

White Paper. Blindfolded SQL Injection

PROC SQL for SQL Die-hards Jessica Bennett, Advance America, Spartanburg, SC Barbara Ross, Flexshopper LLC, Boca Raton, FL

Internet/Intranet, the Web & SAS. II006 Building a Web Based EIS for Data Analysis Ed Confer, KGC Programming Solutions, Potomac Falls, VA

An macro: Exploring metadata EG and user credentials in Linux to automate notifications Jason Baucom, Ateb Inc.

Tips, Tricks, and Techniques from the Experts

Overview. NT Event Log. CHAPTER 8 Enhancements for SAS Users under Windows NT

Using SAS/IntrNet as a Web-Enabled Platform for Clinical Reporting

Paper PO03. A Case of Online Data Processing and Statistical Analysis via SAS/IntrNet. Sijian Zhang University of Alabama at Birmingham

StARScope: A Web-based SAS Prototype for Clinical Data Visualization

Simple Rules to Remember When Working with Indexes Kirk Paul Lafler, Software Intelligence Corporation, Spring Valley, California

Let There Be Highlights: Data-driven Cell, Row and Column Highlights in %TAB2HTM and %DS2HTM Output. Matthew Flynn and Ray Pass

Automate Data Integration Processes for Pharmaceutical Data Warehouse

1. To start Installation: To install the reporting tool, copy the entire contents of the zip file to a directory of your choice. Run the exe.

Performance Test Suite Results for SAS 9.1 Foundation on the IBM zseries Mainframe

Importing Excel Files Into SAS Using DDE Curtis A. Smith, Defense Contract Audit Agency, La Mirada, CA

PO-18 Array, Hurray, Array; Consolidate or Expand Your Input Data Stream Using Arrays

Nine Steps to Get Started using SAS Macros

Building and Customizing a CDISC Compliance and Data Quality Application Wayne Zhong, Accretion Softworks, Chester Springs, PA

Building a Customized Data Entry System with SAS/IntrNet

Building a Web Based EIS for Data Analysis Ed Confer, KGC Programming Solutions, Potomac Falls, VA

The SAS Data step/macro Interface

Permuted-block randomization with varying block sizes using SAS Proc Plan Lei Li, RTI International, RTP, North Carolina

Project Request and Tracking Using SAS/IntrNet Software Steven Beakley, LabOne, Inc., Lenexa, Kansas

Enhancing the SAS Enhanced Editor with Toolbar Customizations Lynn Mullins, PPD, Cincinnati, Ohio

ABSTRACT INTRODUCTION THE MAPPING FILE GENERAL INFORMATION

PharmaSUG Paper QT26

Abstract. Introduction. System Requirement. GUI Design. Paper AD

Macro utility to compare multiple SAS data sets Krish Krishnan, Statistical Programming Scientist, Quintiles

Web Reporting by Combining the Best of HTML and SAS

How To Use Sas With A Computer System Knowledge Management (Sas)

CHAPTER 1 Overview of SAS/ACCESS Interface to Relational Databases

The Power of CALL SYMPUT DATA Step Interface by Examples Yunchao (Susan) Tian, Social & Scientific Systems, Inc., Silver Spring, MD

Scatter Chart. Segmented Bar Chart. Overlay Chart

Producing Listings and Reports Using SAS and Crystal Reports Krishna (Balakrishna) Dandamudi, PharmaNet - SPS, Kennett Square, PA

Sending s in SAS to Facilitate Clinical Trial Frank Fan, Clinovo, Sunnyvale, CA

Salary. Cumulative Frequency

HTML Egg Pro. Tutorials

Programming with SQL

TECHNIQUES FOR BUILDING A SUCCESSFUL WEB ENABLED APPLICATION USING SAS/INTRNET SOFTWARE

Subsetting Observations from Large SAS Data Sets

Streamlining Reports: A Look into Ad Hoc and Standardized Processes James Jenson, US Bancorp, Saint Paul, MN

Transcription:

Post Processing Macro in Clinical Data Reporting Niraj J. Pandya ABSTRACT Post Processing is the last step of generating listings and analysis reports of clinical data reporting in pharmaceutical industry and is the essential aspect of better presentable reports. In general these macros developed in SAS software are very flexible for repeated use and can work with varying needs of report presentation. Post processor macros generally take care of different formatting, display, and other presentation attributes associated with the report. There are various methods to generate and invoke the post processor macros. This paper discusses such methods to create, and effectively use the post processor macros in variety of reporting needs. The approaches suggested here include usage of global macro variables by resolving such variables in the post processor macro and development of post processor macro based on the report presentation needs. The paper also talks about aspects like flexibility, user control, and effectiveness of the post processor macro usage. This paper concludes with further recommendations about development of effective post processor macros. INTRODUCTION Bringing new drugs to the people is a very complex task for any drug making company. Drug making companies are spending tremendous amount of time, energy and money in clinical trials. With new data arriving continuously from different research partners, labs, CROs (Clinical Research Organizations) and EDC (Electronic Data Capture) vendors, and tight budgets and tough guidelines from regulatory authorities, this makes the task of statistical analysis and reporting of these data more complex. SAS has been the leader for years for providing solutions to such complex tasks for pharmaceutical industry with its breakthrough capabilities. This paper is targeted for clinical data reporting and deals with different formatting and display issues and other various needs of presenting the clinical data in the form of tables and listings. The techniques mentioned here might be useful for the presentation of other type of data (i.e. Sales and marketing, Manufacturing, Finance, Information Services, Human Resources etc.). This paper is most useful for the beginners who are novice in clinical data reporting using SAS. POST PROCESSING Post processing is a technique in which the text output report file from a reporting SAS program or macro program, is used as input to another macro program and, in turn, passes through different stages to get its different attributes like page size, line size, page numbers, titles, footnotes, headline, footline etc. processed in the more acceptable and presentable form to the regulatory authorities. The secondary macro program stated above is called a Post Processing Macro and is mainly designed to provide cosmetic changes to the final output of the report-writing macro program. The user can write one macro which can take care of all the display attributes or can write several separate macros to take care of different things and then call these macros according to the requirement of the report. Post processor macros generally use many SAS system functions, data steps, procedures and can call other macros. Using global macro variables, passing them in to post processing macro and resolving them adds flexibility and user control. The user can also create blank reports with same formatting attributes as of other successful reports when no subject meets reporting requirements and can add message in the blank report about this using post processor macro. Having such post processing macros in place can save lots of time of several programmers they could have wasted in the efforts of formatting the report, it adds flexibility and repeated use of it saves resources which justifies the time and other 1

resources invested by the company or organization in developing such macros. Use of such macros also standardized the format of reports across the company. INPUT AND OUTPUT Any SAS procedure that generates some sort of output text report file (i.e. PROC REPORT, PROC TABULATE, PROC FREQ, PROC MEANS etc.) can be used as input for Post Processing. This can be specified by passing the parameters as INFILE. The output file of the macro can be specified by passing the parameter as OUTFILE which can be used in file statement of the data step that writes the output with PRINT option. %macro postproc (INFILE =, OUTFILE =); In case of input file does not exist, you can put a message using system function FILEEXIST. %if not %sysfunc (FILEEXIST (&INFILE)) %then Put NOTE: File Not Found ; HEADLINE Headline is used to separate the main analysis report or listing from the titles section of the report. To add a headline below the last title and above the column headings, you need to get the last title number in the report. When there is no title defined earlier you can suppress the headline by passing the parameter HEADLINE in the macro definition and setting its value equal to 0 which will be checked in the macro later and headline will be suppressed. This way it gives you the control of whether to have a headline in the report or not. The last title number can be retrieved using the SASHELP directory. Once you get the number of last title, you need to read the input file line by line which includes titles and footnotes specified earlier and find out the length of the longest line in the report and store it in a macro variable. Using this macro variable you can output a line below the last title. Select max (NUMBER) into: TITLLAST from sashelp.vtitle where TYPE ='T' and compress (TEXT) ^=''; The above code will look in VTITLE dataset in the SASHELP directory and will find out the maximum value of NUMBER variable where TYPE is for title and TEXT of the title is not missing and will return the value in &TITLLAST macro variable. When no title is defined, headline can be suppressed using the following condition in the addition to the above code. %if (^&sqlobs) %then %do; %let HEADLINE =0; 2

READ IN TEXT REPORT FILE Using SAS data steps you can read the text report file and create a dataset which contains few variables which can be used to determine the page size, line size, maximum length of the line etc. These variables will be used to insert a headline or footline at some specific point of the report. While reading the text report file, a new page can be identified by reading form feed character which can be easily read by using hex literal in SAS. A hex literal in SAS is any of the 16 hex characters (0-9 and A-F) in quotes followed by an x. The hexadecimal value for form feed or new page character is 0c x. While reading the text report file, in the first pass you can calculate and store different attributes in variables and then in the second run you can output the report file with headline and footline. Let us say page numbers will be stored in PAGENUM. The number of lines will be stored in NLINES. The length of line will be stored in LLINE. The length of the longest line will be stored in LOFLLINE. The content of each line will be stored in LINE. You can define one global macro variable &LINESIZE and specify the line size there so that it can be used by resolving this macro variable in the macro later on. The following code will read the input text report file and will calculate other variables. data pass1; length PAGENUM NLINES LLINE 8 LINE $200; retain PAGENUM 0 LLINE 0 NLINES 0; infile "&INFILE" end=eof length = &LINESIZE; input @1 LINE; if LINE = 0c x or _N_ = 1 then do; PAGENUM+1; NLINES = 0; If LINE =: 0c x then LINE = substr (LINE, 2); NLINES+1; LLINE = length (LINE); In the above code, each line s content will be read and stored in LINE until end of file is reached. Each line s number in that particular page will be assigned and it will be stored in NLINES and length of string in each line which will be stored in LLINE. When encountering a new page, PAGENUM will increase by 1 and line number for that particular page will start again from 0. The following code will find the maximum of the line length which was stored in LLINE in the previous code example and it will put its value in a macro variable &LOFLLINE. proc sql ; select max(lline) into: LOFLLINE from pass1; 3

INSERT HEADLINE Now you have the length of the longest line in the report and you have the last title number from previously explained code. By comparing the last title number with the line number of each page you can find the exact position where a headline has to be inserted in each page of the report. The following code will insert the headline in the report. data pass2; set pass1; %if &HEADLINE = 1 %then %do; if (NLINES = &TITLLAST) then do; LINE = repeat ('-', &LOFLLINE); return; The above code will check if the HEADLINE parameter is on by checking its value equal to 1. If condition is satisfied, a LINE of character - with the length of longest line in the report (&LOFLLINE) will be output after last title in the dataset by PAGENUM which will be output as final report in turn. FOOTLINE Footline is required to separate the main data report or listing from the footnotes. To add a footline above the first footnote and below the last line of data report or listing, you need to get the first footnote in the report as a variable for comparison. When there is no footnote defined earlier, you can suppress the footline by passing the parameter FOOTLINE in the macro definition and setting its value equal to 0 which will be checked in the macro later and footline will be suppressed. This way it gives you the control of whether to have footnote in the report or not. The first footnote can be retrieved using the SASHELP directory in a form of a character variable. Once you get the string of the first footnote, you need to read the input file line by line which includes titles and footnotes specified earlier and find out the length of the longest line in the report (as explained in earlier section) and store it in a macro variable (&LOFLLINE). Using this macro variable you can output a line above the first footnote. select trim (TEXT) into :FOOT1 from sashelp.vtitle where TYPE ='F' and NUMBER = 1; 4

The above code will read from the VTITLE dataset in the SASHELP directory and will store the string of TEXT variable in the macro variable &FOOT1 where TYPE is for footnote and NUMBER of the footnote is 1. When no footnote is defined, a footline can be suppressed using following condition in the addition to the above code. %if (^&sqlobs) %then %do; %let FOOTLINE =0; INSERT FOOTLINE Now you have the length of the longest line in the report and you have the text of first footnote from previously explained code. By comparing the value of macro variable &FOOT1 with the value of LINE variable from pass1 dataset, you can find the exact position where footline has to be inserted in each page of the report. The following code will insert the footline in the report. data pass2; set pass1; %if &FOOTLINE = 1 %then %do; if LINE = &FOOT1 then do; LINE = repeat ('-', &LOFLLINE); LINE = &FOOT1 ; The code above will check if the FOOTLINE parameter is on by checking if its value is equal to 1. If the condition is satisfied, a LINE of character - with the length of longest line in the report (&LOFLLINE) will be output before the first footnote in the dataset by PAGENUM which will be output as final report in turn. PAGE NUMBERS When required in clinical data reporting, page numbers can be presented in the form of PAGE m of n in the first title using the code stated below. At the same time, the date and time stamp of report generation can be suppressed from first title using the NODATE option and can be presented in the last footnote of the report using SAS system functions like &SYSDATE, &SYSTIME and &SYSDAY. As you have already counted the total number of pages and stored it in the PAGENUM variable while reading the input text report file, you can get the maximum number of pages in the report and then you can present it in the form of PAGE m of n. 5

Select max (PAGENUM) into: MAXPAGE from pass1; The code above will calculate the maximum of PAGENUM from dataset pass1 and then store it in the macro variable &MAXPAGE. Now you have to find the text of the first title and store it in a macro variable so that you can compare it later with the value of LINE variable defined earlier in pass1 dataset. select trim (TEXT) into: TITL1 from sashelp.vtitle where TYPE ='T' and NUMBER = 1; The code above will read from the VTITLE dataset in the SASHELP directory and will store the first title s string from TEXT variable in to macro variable &TITL1. Now that you have required information available, you can compare two variables containing the value of first title and when that condition is satisfied, you can enter the page number information in the dataset as a text value of variable LINE. data pass2; set pass1; if LINE = &TITL1 then do; LINE = right ( PAGE compress (PAGENUM) of compress (&MAXPAGE) ; LINE = &TITL1 ; The code above will compare the first title s text from macro variable &TITL1 with the LINE variable and when condition is satisfied it will enter the text PAGE m of n which is right aligned in the report. OUTPUT THE REPORT At last, with the use of _NULL_ dataset and FILE statement with PRINT option, you can print the report with headlines and footlines where required and also change the format of page numbers which will be used in the finished report. data _NULL_; set pass2; file &OUTFILE notitles print; 6

ALTERNATIVE METHODS Apart from the techniques mentioned so far in this paper, you can also draw a headline and footline when using PROC REPORT for generating a report. You can use COMPUTE BEFORE and COMPUTE AFTER statements respectively in PROC REPORT to draw a dashed line before the first raw of report and after the last raw of report. But when variables in PROC REPORT are used as ID variables, then this method may not work properly. Also every time you write a PROC REPORT, you have to compute the length of line. This method will also not work with any other procedures that generate report output such as PROC TABULATE, PROC FREQ, PROC MEANS etc. CONCLUSION In the reporting of clinical study data, many times the presentation available from the default SAS settings is not acceptable or not enough and you need to modify it. Effective presentation of data is of equal importance as the data being presented in an analysis report or listing. Most of the time it is very time consuming for a novice programmer to make a simple change in the attributes of report and so it is in the interest of the company or organization to have post processing macros in place which will save time and at the same time help in keeping all reports in a standard format across the company or organization. There are many other aspects of the reporting that can be standardized, such as a standard footnote consisting of the company s name, its copyright and a confidentiality statement, a specific font size and font style in the report, color of the text, background color of the report, type of the output (HTML, RTF, PRINTER) etc. which can be controlled with such macros, but these are out of the scope of this paper. It is time consuming to write a post processing macro but well worth the effort, as it saves lots of time and other resources with repeated usage.. CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the author at: Name: NIRAJ J PANDYA Phone: 201-936-5826 E-mail: niraj_mech@yahoo.com 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. 7