A SAS Macro Utility to Modify and Validate RTF Outputs for Regional Analyses Jagan Mohan Achi, PPD, Austin, TX Joshua N. Winters, PPD, Rochester, NY

Similar documents
A Tool to Compare Different Data Transfers Jun Wang, FMD K&L, Inc., Nanjing, China

CC13 An Automatic Process to Compare Files. Simon Lin, Merck & Co., Inc., Rahway, NJ Huei-Ling Chen, Merck & Co., Inc., Rahway, NJ

TLF Management Tools: SAS programs to help in managing large number of TLFs. Eduard Joseph Siquioco, PPD, Manila, Philippines

Let SAS Help You Easily Find and Access Your Folders and Files

Implementing external file processing with no record delimiter via a metadata-driven approach

A Macro that can Search and Replace String in your SAS Programs

Automated Checking Of Multiple Files Kathyayini Tappeta, Percept Pharma Services, Bridgewater, NJ

Using GSUBMIT command to customize the interface in SAS Xin Wang, Fountain Medical Technology Co., ltd, Nanjing, China

PharmaSUG China Paper 059

When Powerful SAS Meets PowerShell TM

Run your reports through that last loop to standardize the presentation attributes

Tracking Dataset Dependencies in Clinical Trials Reporting

A Macro to Keep Titles and Footnotes in One Place

PharmaSUG Paper TT11

PROBLEM FORMULATION, PROPOSED METHOD AND DETAILED DESCRIPTION

A Macro to Create Program Inventory for Analysis Data Reviewer s Guide Xianhua (Allen) Zeng, PAREXEL International, Shanghai, China

Missing Pages Report. David Gray, PPD, Austin, TX Zhuo Chen, PPD, Austin, TX

PharmaSUG Paper PO12

Create a Format from a SAS Data Set Ruth Marisol Rivera, i3 Statprobe, Mexico City, Mexico

A Macro To Generate a Study Report Hany Aboutaleb, Biogen Idec, Cambridge, MA

PharmaSUG 2013 CC26 Automating the Labeling of X- Axis Sanjiv Ramalingam, Vertex Pharmaceuticals, Inc., Cambridge, MA

LST in Comparison Sanket Kale, Parexel International Inc., Durham, NC Sajin Johnny, Parexel International Inc., Durham, NC

PDF Multi-Level Bookmarks via SAS

Sorting big datasets. Do we really need it? Daniil Shliakhov, Experis Clinical, Kharkiv, Ukraine

Regaining Some Control Over ODS RTF Pagination When Using Proc Report Gary E. Moore, Moore Computing Services, Inc., Little Rock, Arkansas

So Much Data, So Little Time: Splitting Datasets For More Efficient Run Times and Meeting FDA Submission Guidelines

Prove QC Quality Create SAS Datasets from RTF Files Honghua Chen, OCKHAM, Cary, NC

Let s Get FREQy with our Statistics: Data-Driven Approach to Determining Appropriate Test Statistic

Matt Downs and Heidi Christ-Schmidt Statistics Collaborative, Inc., Washington, D.C.

Data Edit-checks Integration using ODS Tagset Niraj J. Pandya, Element Technologies Inc., NJ Vinodh Paida, Impressive Systems Inc.

Quick and Efficient Way to Check the Transferred Data Divyaja Padamati, Eliassen Group Inc., North Carolina.

Quicker Than Merge? Kirby Cossey, Texas State Auditor s Office, Austin, Texas

Utilizing SAS for Cross- Report Verification in a Clinical Trials Setting

Validation Summary using SYSINFO

A SAS Macro to Create Validation Summary of Dataset Report

Macro Method to use Google Maps and SAS to Geocode a Location by Name or Address

Your Own SAS Macros Are as Powerful as You Are Ingenious

Quality Control of Clinical Data Listings with Proc Compare

A SAS Macro for Producing Benchmarks for Interpreting School Effect Sizes

ODS DOCUMENT, a practical example. Ruurd Bennink, OCS Consulting B.V., s-hertogenbosch, the Netherlands

The Output Bundle: A Solution for a Fully Documented Program Run

Give me EVERYTHING! A macro to combine the CONTENTS procedure output and formats. Lynn Mullins, PPD, Cincinnati, Ohio

An Efficient Tool for Clinical Data Check

PharmaSUG Paper PO10

Clinical Data Visualization using TIBCO Spotfire and SAS

INTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS

TLFs: Replaying Rather than Appending William Coar, Axio Research, Seattle, WA

This paper describes a report layout for reporting adverse events by study consumption pattern and explains its programming aspects.

3N Validation to Validate PROC COMPARE Output

Taming a Spreadsheet Importation Monster

Uncommon Techniques for Common Variables

%MISSING: A SAS Macro to Report Missing Value Percentages for a Multi-Year Multi-File Information System

Keeping Track of Database Changes During Database Lock

Electricity Forecasting Full Circle

Chasing the log file while running the SAS program

PharmaSUG Paper TT10 Creating a Customized Graph for Adverse Event Incidence and Duration Sanjiv Ramalingam, Octagon Research Solutions Inc.

Data Quality Review for Missing Values and Outliers

Top Coding Tips. Neil Merchant Technical Specialist - SAS

Combining TLFs into a Single File Deliverable William Coar, Axio Research, Seattle, WA

PharmaSUG Paper AD06

A Useful Macro for Converting SAS Data sets into SAS Transport Files in Electronic Submissions

PhUSE US Connect 2018 Paper CT06 A Macro Tool to Find and/or Split Variable Text String Greater Than 200 Characters for Regulatory Submission Datasets

Reading in Data Directly from Microsoft Word Questionnaire Forms

One Project, Two Teams: The Unblind Leading the Blind

Reporting Template. By Denis Fafard Business Analyst WCB - Alberta

Using an ICPSR set-up file to create a SAS dataset

Summary Table for Displaying Results of a Logistic Regression Analysis

How a Code-Checking Algorithm Can Prevent Errors

Posters. Paper

Text Wrapping with Indentation for RTF Reports

The Ugliest Data I ve Ever Met

Not Just Merge - Complex Derivation Made Easy by Hash Object

ABSTRACT: INTRODUCTION: WEB CRAWLER OVERVIEW: METHOD 1: WEB CRAWLER IN SAS DATA STEP CODE. Paper CC-17

Advanced Visualization using TIBCO Spotfire and SAS

What Do You Mean My CSV Doesn t Match My SAS Dataset?

A Fully Automated Approach to Concatenate RTF outputs and Create TOC Zhiping Yan, Covance, Beijing, China Lugang Xie, Merck, Princeton, US

A Mass Symphony: Directing the Program Logs, Lists, and Outputs

Customized Flowcharts Using SAS Annotation Abhinav Srivastva, PaxVax Inc., Redwood City, CA

ABSTRACT INTRODUCTION WORK FLOW AND PROGRAM SETUP

HAVE YOU EVER WISHED THAT YOU DO NOT NEED TO TYPE OR CHANGE REPORT NUMBERS AND TITLES IN YOUR SAS PROGRAMS?

ET01. LIBNAME libref <engine-name> <physical-file-name> <libname-options>; <SAS Code> LIBNAME libref CLEAR;

Using a Control Dataset to Manage Production Compiled Macro Library Curtis E. Reid, Bureau of Labor Statistics, Washington, DC

A Macro that Creates U.S Census Tracts Keyhole Markup Language Files for Google Map Use

Text Generational Data Sets (Text GDS)

ODS/RTF Pagination Revisit

ODS in an Instant! Bernadette H. Johnson, The Blaze Group, Inc., Raleigh, NC

SAS USER FORUM NORWAY 2017 USER FORUM. Show Off Your OAuth Authenticating to Web Services in SAS

Create Metadata Documentation using ExcelXP

Coders' Corner. Paper Scrolling & Downloading Web Results. Ming C. Lee, Trilogy Consulting, Denver, CO. Abstract.

Make Your Life a Little Easier: A Collection of SAS Macro Utilities. Pete Lund, Northwest Crime and Social Research, Olympia, WA

Post-Processing.LST files to get what you want

%Addval: A SAS Macro Which Completes the Cartesian Product of Dataset Observations for All Values of a Selected Set of Variables

SAS (Statistical Analysis Software/System)

PharmaSUG China. model to include all potential prognostic factors and exploratory variables, 2) select covariates which are significant at

Quick Data Definitions Using SQL, REPORT and PRINT Procedures Bradford J. Danner, PharmaNet/i3, Tennessee

Plot Your Custom Regions on SAS Visual Analytics Geo Maps

Hidden in plain sight: my top ten underpublicized enhancements in SAS Versions 9.2 and 9.3

Automate Clinical Trial Data Issue Checking and Tracking

An Automation Procedure for Oracle Data Extraction and Insertion

EXAMPLE 3: MATCHING DATA FROM RESPONDENTS AT 2 OR MORE WAVES (LONG FORMAT)

Transcription:

PharmaSUG 2014 - Paper BB14 A SAS Macro Utility to Modify and Validate RTF Outputs for Regional Analyses Jagan Mohan Achi, PPD, Austin, TX Joshua N. Winters, PPD, Rochester, NY ABSTRACT Clinical Study Reports (CSRs) of clinical trials require the development of the tables, listings, and figures (TLFs) in Rich Text Format (RTF) outputs. The analyses are usually complex and the number of RTF outputs is fairly large depending on the magnitude of the studies. It is not uncommon to see requests to repeat the analyses by region and/or country for multicenter trials to understand the differences in geographical locations. For regional analyses, changes to an RTF output can be but not limited to changing the filename, adding additional information in the title, and modifying the hidden bookmark which is used to ensure that the report refers to the specific TLF from CSRs. Such changes have to be made to the original TLF programs which are time consuming. Therefore, a macro was developed to systematically modify the RTF outputs, save the processed RTF outputs with new names, and validate the original and modified RTF outputs to confirm that the only intended changes were made to the RTF outputs. INTRODUCTION This paper demonstrates how to read RTF outputs into SAS and make intended changes to the contents of the outputs such as bookmarks, titles, footnotes, column labels, etc., and save the modified outputs with new names. Then, the macro reads both original and modified versions of the RTF outputs into SAS and compares the two versions line by line, producing a report displaying the lines where changes were made. METHOD Process 1: Read RTF outputs into SAS and make intended changes to the contents of the outputs such as bookmarks, titles, footnotes, column labels, etc. This is a macro call to process all the rtf files from a directory- path. 1.1 This step creates a list of rtf files from a user define path and stores them in file macro variables. filename dirlist pipe "dir /-c /q /t:c ""&path""" ; data fnums1(keep=filename); infile dirlist missover pad length=len; input @01 line $varying200. len eof; if index(upcase(line),'.rtf'); fname=line; array temp_ $200 date time timef sizec owner filename; do over temp_; temp_=scan(fname,_i_,""); filename=substr(filename,1,length(filename)-4); set fnums1; call symputx(catt("file",_n_),strip(filename)); call symputx("totfiles",strip(put(_n_,best.))); 1

Loop over the number of RTF outputs. Each iteration will read the file and does the following actions: 1.2 Rename rtf file with specific region. It uses rename functionality in a data step to rename a file with region id. rc=rename ("&path.&infile..rtf","&path.\&infile._&regionid..rtf",'file') 1.3 Read the rtf file and store the title text into a macro variable infile "&path.&infile..rtf" length=len end=eof lrecl=2000; Example: RTF %if Output %substr(&infile.,1,1)=t #76 T14.1.1.1A_Disp.rtf %then %do; if index(upcase(linetxt),"table") then do; tittxt=scan(scan(linetxt,2,"{"),1,"\"); % set null_; tittxt=substr(tittxt,1,length(tittxt)-1); call symputx("title3",strip(tittxt)); 1.4 Update Title, Bookmarks and References and create a.tmp file from rtf output to store the processed changes. if index(linetxt,"{\header\pard\plain\qc{") then header=1; if header=1 then do; linetxt=tranwrd(linetxt,"&title3.","%trim(%bquote(&title 3._&regionid))"); linetxt=tranwrd(linetxt,"\cell}","_&regionid. \cell}"); if index(linetxt,'{\*\bkmkstart}{\*\bkmkend}') and titl=1 then do; linetxt=tranwrd(linetxt,"&title3","%trim(%bquote(&title3._&regionid))"); 1.5 Save the modified outputs Put the updated file into a.tmp file and read into the modified output. After the file is modified, the.tmp file is deleted. Replace the existing file with the modified output.tmp file using the steps below. infile "&infile..tmp " LENGTH=len end=eof lrecl=2000; file "&PATH.&infile..RTF " lrecl=2000; input @1 linetxt $VARYING2000. len; put linetxt $varying2000. len; %let rc = %sysfunc(filename(fname,&infile..tmp)) ; %if &rc eq 0 %then %do ; %let rc = %sysfunc(fdelete(&fname)) ; %let rc = %sysfunc(filename(&fname)) ; %end ; 2

Process 3: Read the original and modified RTF outputs into SAS and compare the two versions 3.1 Output original and modified RTF file names from their respective folders into two datasets. filename ori pipe "dir ""\\TLF\Output\&region\Original"" /b"; filename mod pipe "dir ""\\TLF\Output\&region\Modified"" /b"; data dirlist_ori; length txt_line $256 ; infile ori length=reclen ; input txt_line $varying256. reclen ; run ; data dirlist_mod; length txt_line $256 ; infile mod length=reclen ; input txt_line $varying256. reclen ; run ; proc sort data= dirlist_ori; by txt_line; proc sort data= dirlist_mod; by txt_line; 3.2 Put the total number of RTF outputs into a macro variable. %let dsid=%sysfunc(open(dirlist_ori, is)); %let cnt= %sysfunc(attrn(&dsid.,nobs)); %let rc= %sysfunc(close(&dsid)); %put Total number of RTF outputs= &cnt; 3.3 Loop over the number of RTF outputs. Each loop will read an original and its respective modified RTF outputs into SAS. Each pair of RTF outputs will be compared line by line. libname &region "\\TLF\Output\&region"; proc datasets lib=&region memtype=data nolist kill; quit; data &region._report; set dirlist_ori; %do i=1 %to &cnt; set dirlist_ori; if _n_ eq &i then call symput('rtf_ori',strip(buffer)); set dirlist_mod; if _n_ eq &i then call symput('rtf_mod',strip(buffer)); 3

/* Read the pair of RTF outputs into SAS*/ data rtf_ori; infile "\\TLF\Output\&region\Original\&rtf_ori" LENGTH=len end=eof lrecl=2000; input @1 linetxt_ori $VARYING2000. len; index= _n_; data rtf_mod; infile "\\TLF\Output\&region\Modified\&rtf_mod" LENGTH=len end=eof lrecl=2000; input @1 linetxt_mod $VARYING2000. len; index= _n_; /* Merge the pair of RTF outputs together. Flag rows with any differences other than the intended changes. Output rows which are different from each other due to the intended changes. Output other rows as well. */ data temp (drop= linetxt_mod1) temp1 (drop= linetxt_mod1); length linetxt_mod1 $2000; merge rtf_ori rtf_mod end= eof; by index; linetxt_mod1= tranwrd(linetxt_mod,"_&region",''); if strip(compress(linetxt_ori)) ne strip(compress(linetxt_mod1)) then flag= 1; else flag= 0; if compress(linetxt_mod) ne compress(linetxt_ori) then output temp1; else output temp; /* Report whether the pair of RTF outputs contains differences other than the intended changes.*/ %let flag=; proc sql noprint; select sum(flag) into :flag from temp; quit; %let flag= &flag; data &region._report; set &region._report; if strip(buffer) eq "&rtf_ori" then flag= &flag; %if &i lt 10 %then %let dset_name= 00&i; %else %if &i ge 10 & &i lt 100 %then %let dset_name= 0&i; %else %let dset_name= &i; data &region..&region._&dset_name. ; set temp; 4

/* Append rows which are different due to the intended changes into the final report. */ data temp1; length deliverable_id $200 rtf_num 8; set temp1; deliverable_id= "&rtf_ori"; rtf_num= &i; drop flag; proc append base=&region._report data= temp1 force; % Process 4: Create a report including the modified text where the intended changes are made in comparison to the original text proc copy in= work out= &region; select &region._rtf_modification_report &region._report; ods listing close; ods html file= "\\TLF\Output\&region\&region._rtf_modification_report.xls"; proc print data= &region..&region._rtf_modification_report; ods html close; ods html file= "\\TLF\Output\&region\&region._report.xls"; proc print data= &region..&region._report; ods html close; CONCLUSION The above process demonstrates how to systematically modify RTF outputs and validate the modified outputs to confirm that the only changes are the intended changes. In summary, this application efficiently modifies RTF outputs in order to save resources especially when time is a constraint. CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the author at: Name: Jagan Mohan Achi Enterprise: PPD Address: 7551 Metro Center Drive City, State ZIP: Austin, Texas Work Phone: (512) 747-5718 E-mail: jagan.achi@ppdi.com Name: Joshua N. Winters Enterprise: PPD City, State ZIP: Rochester, New York Work Phone: (910) 558-4143 E-mail: joshua.winters@ppdi.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. The contents of this paper are the work of the author and do not necessarily represent the opinions, recommendations, or practices of PPD. 5