A Tool to Reduce the Time Used in the Preparation of the Statistical Review Aid Used for Electronic Submission Eunice Ndungu, Merck Research Labs, Merck & Co., Blue Bell, PA 19422 ABSTRACT Statistical programmers in the pharmaceutical industry are usually faced with tight timelines within which to prepare SRA (Statistical Review Aids) that reflect the information submitted to the FDA through the CSR (Clinical Study Report). One can manually identify and copy all files needed in the submission, to a submission folder, running them from the destination folder to make sure they run correctly and accurately reproduce outputs in the CSR. This manual process, however, can be time-consuming. The programmer is faced with the task of identifying all the data sets accessed by the SAS macros. This is done by scrolling through SAS code to identify transport files invoked by the macros, or painfully scanning through the logs from the macro runs for error messages of data sets that the macro is looking for but cannot find. To eliminate the necessity for this manual drudgery, the %copy macro was developed. This paper discusses the design of this macro and how it can be used in two situations. 1. INTRODUCTION The %copy macro was designed for use in an environment in which analysis data sets are stored in the form of SAS transport files. Transport files are then accessed by the analysis macros which then generate tables, listings and graphs. This paper describes the use of the %copy macro in two scenarios In the first scenario, the user can specify to the %copy macro the names of the analysis macros used to generate the CSR tables. The user also must specify a search string that %copy can use to find the names of the SAS transport files. Once these are provided, the macro automatically identifies the transport files used in all analysis programs and then automatically copies them to a new area for the FDA In the second scenario, analysis macros generate not only the CSR outputs, but also store in a text file the values of the parameters specified when the analysis macro was called. These saved parameter values are used during submission preparation to make macro runs that confirm that the programmer s outputs still match those in the CSR. In this case, the %copy macro can use the file of saved parameter values to identify and copy to the submission area all of the files that may be needed for the submission, including all of the SAS transport files, the SAS macro files, and the calling programs. An overview of the of the %copy macro will be presented, including basic features, assumptions macro parameters, and syntax. In addition, examples are provided illustrating the reading and copying of SAS transport files. 1.1 BASIC FEATURES This macro has the flexibility of: Allowing the user to provide parameters to be used in identifying SAS transport files and macros used to generate CSR output. Using saved parameters if available to locate and copy submission files to the submission area. 1.2 ASSUMPTIONS The following assumptions must be satisfied for the macro to run properly: A SAS auto call library is used to access macros used to generate CSR output. This has a twofold benefit. The macros need to be compiled only once and not through each use. In addition, the calling programs will bear the same names as the macros they invoke, a feature used by the macro to identify calling programs. There is a macro that invokes SAS transport files and converts them to SAS temporary WORK data sets that are then used for analysis. This means that no matter how many SAS transport files are invoked and no matter the location of the call within the program, the %copy macro can recognize the calls and extract the names of the SAS transport files. 1
2. MACRO STRUCTURE 2.1 MACRO SYNTAX %copy (stdmacro=, maccald=, stdcall=, addmacs=, xptcall=, actucall=, cpymacs=, cpypgms=, destdat=, destmac=, destpgm=); 2.2TABLE OF MACRO PARAMETERS MACRO PARAMETER VALUE AND DESCRIPTION VARIABLE Parameters that apply to the first scenario ADDMACS Add a list of macros in which to search for XPT calls. Separate these names by a space. Example. addmacs=mcombo ecg vital. Else, leave blank. ACTUCALL XPTCALL Put the names of the actual macros used to read in the XPT files. Must match one-to-one with list in addmacs. E.g. actucall=xptmac1 xptmac2 xptmac2 Submit the keyword parameter call to read in XPT file that corresponds to each of the macros in ADDMACS. E.g. xptcall=intrans xptlist getxpt. Else leave blank. Parameters that apply to the second scenario STDMACRO Yes -I invoked some macro to read in XPT files and parameters were saved (scenario 2).. No -No macro that saves parameters was used (scenario 1). MACCALD If STDMACRO=yes, enter the name of the macro used to invoke XPT files and save the parameters. Example STDMACRO=getXPT if a macro %getxpt was used. Leave blank if the parameter for STDMACRO=No STDCALL If STDMACRO=yes enter the keyword parameter used by the macro that invokes the XPT data. Example. STDCALL =INTRANS for %getxpt(intrans=xptdata) Parameters on action to copy/not copy and destination specification CPYMACS Yes -Copy the macros that used the SAS transport files to the submission folder No -Do not copy macros to the submission area CPYPGMS Yes -Copy the non-macro SAS programs (calling programs) that used the SAS transport files to the submission folder No -Do not copy the non-macro SAS programs to the submission area DESTDAT Give the destination directory to put XPT data sets. E.g. u:\submission\sasdata DESTMAC Give the destination directory to put macros from macro libraries if the parameter CPYMACS=Yes E.g. u:\submission\sasmacros DESTPGM Give the destination directory to put the non-macro SAS programs from the Assembly area if CPYPGMS=Yes e.g. u:\submission\saspgms 2
2.3 FOLDER STRUCTURE OF THE ASSEMBLY AREA Below is a sample folder structure of the assembly area depicting the location of: SAS Transport files in the data analysis folder. Analysis macros in the SASmacros folder. Macro calling programs or stand alone SAS code in the SASpgms folder. Assembly SASdata SASmacros Demodata.xpt, labdata.xpt, rxcomp.xpt, vitdata.xpt, reasdisc.xpt, tempdat.xpt Ptaccnting.sas, ptacnting2.sas, csva.sas, comply.sas, basesur.sas, tempmac.sas, copy.sas SASpgms Ptaccnting.sas, ptacnting2.sas, adhoc1.sas, vchg.sas, copy.sas, csva.sas, comply.sas, basesur.sas Tools Utltypgm.sas, fda_save_parameters.txt 2.4.1 SCENARIO 1: ALLOWING THE USER TO PROVIDE PARAMETERS TO BE USED IN IDENTIFYING SAS TRANSPORT FILES AND MACROS USED TO GENERATE CSR OUTPUT. In the case where parameters have not been saved, the programmer provides parameters as in the examples shown below. %copy(addmacs = ptacnting ptacnting2 ptacnting2 vchg, actucall = convertxpt setdata rddat mcombo, xptcall = intrans xptlist rdxpt intrans, cpymacs = Yes, cpypgms = Yes, destdat = u:\submission\sasdata, destmac = u:\submission\sasmacros, destpgm = u:\submission\saspgms); In this case, each entry in any one of the first three parameters has a one-to-one match with the corresponding entry in the other two. Each of the three parameters has the same number of elements, separated by a space. In this example, each has 4 elements. In this scenario, the %copy macro scans through each of the macros ptacnting.sas, ptacnting2.sas and vchg.sas. It looks for calls to the corresponding macros convertxpt.sas, setdata.sas, rddat.sas and mcombo.sas. The latter set would be macros that convert SAS transport files to SAS WORK temporary data sets. The parameter values entered for the keyword parameter XPTCALL, e.g. intrans, xptlist, rdxpt, and intrans, point the %copy macro to the names of the SAS transport files invoked. See example below for the first macro on the call. 3
%macro ptacnting; **convert SAS transport file to temporary SAS data set**; %convertxpt(intrans=xptdata, outdata=rxcomp); *XPTdata is the xpt file; %mend ptacnting; In this case, XPTdata.xpt would be the SAS transport file. As in the second scenario, the user has the option of copying the XPT file and the macro in which it is used, to a destination submissions folder that they specify. 2.4.2 SCENARIO 2: USING SAVED PARAMETERS IF AVAILABLE Below is a sample text file (fda_save_parameters.txt) of parameters saved from a calling program in the SASpgms folder. In the text file, the value assigned to the macro parameter MACRONM (see below), gives the name of the macro in which the %copy macro will search for calls to SAS transport files. In this case, the macro would be csva.sas. Armed with these names and a string for the keyword parameter used by the macro that invokes the XPT data (see XPTCALL in parameter table and INTRANS parameter in the example below); the %copy macro can track and find the transport files. Example. fda_save_parameters.txt macronm = csva macronm = csva Protocol=100 Protocol=101 Population=ALL Population=MITT Timepoint=99 Timepoint=0 Study= Nesug10 Study= Nesug11 Tabname=12 Tabname=19 SuptList=No SuptList=Yes Saveparms=yes Saveparms=yes Datesaved=01Jun04 Datesaved=03Jun04 Example of call to a SAS transport file %macro csva; **convert transport file to temporary SAS data set**; %convertxpt (INTRANS=rxcomp, outdata=rxcomp); *rxcomp is the xpt file; %mend csva; Other CSVA SAS statements Two examples of parameter calls to generate output and save parameters. %csva(macronm = csva, Protocol=100, Population=ALL, Timepoint=99, Study= Nesug10, Tabname=12, SuptList=No, Saveparms=yes ); %csva(macronm = csva, Protocol=101, Population=MITT, Timepoint=0, Study= Nesug11, Tabname=19, SuptList=Yes, Saveparms=yes ); 4
EXAMPLE OF THE PROCESS OF CREATING AND USING A TEXT FILE OF SAVED PARAMETERS Suppose a programmer had a macro that generated differed tables based on parameter selections in the macro call. In the example above, two separate calls to the %csva macro would generate two different tables based on different protocol and population selections. Suppose the %csva macro had an inbuilt functionality to save the above parameter selections in a text file. Using the saveparms= keyword parameter, the end user would only save parameters for output that would be included in the CSR, and hence the submission. Consequently, the %copy macro would easily identify from the text file, the macros used to generate CSR tables and target only these files in the search for calls to transport files. A sample call to %copy macro %copy(stdmacro = yes, maccald = saveparms, stdcall = intrans, destdat =u:\submission\sasdata, destmac=u:\submission\sasmacros, destpgm=u:\submission\saspgms); After transport files have been identified, they can then be copied to the destination specified by using the parameter DESTDAT, e.g. DESTDAT=u:\Submission\SASdata. Through the optional use of the parameters CPYMACS=yes and CPYPGMS=yes, the macro may also copy over the analysis macros and the calling programs to the destinations specified, e.g. DESTMAC=u:\Submission\SASmacros and DESTPGM=u:\Submission\SASpgms respectively. 3.SAMPLE CODE FOR READING AND MOVING XPT FILES The code extracts given below give the reader a glimpse of the part of the macro that identifies and extracts transport files and also the part that copies over files to destinations dictated by the user. 3.1 Reading SAS XPT files from the macros in the Assembly area %**--------------------------------------------------------------------------------------------** **Assign macro variables for all the XPT data set names invoked in each macro ** **Create a macro variable for the number of transport files to be copied over. ** **-----------------------------------------------------------------------------------------------**; data _null_; set &macname end=eof; datanm=compress(substr(token, index(token, '=') +1, length(token)-index(token, '=') ) ".xpt"); call symput('datanm' left(_n_),datanm); if eof then call symput('d_obs',left(_n_)); run; where &macname = data set containing information passed through %copy call token = variable with the calls to the XPT files &datanm&i = macro variable for the names of transport files 3.2 Moving SAS XPT files to submission area %**-----------------------------------------------------------------------** **Copy over the XPT files from Assembly directory to the user** **specified destination directory. ** **-------------------------------------------------------------------------**; %macro copydat; %do k=1 %to &d_obs; X copy &datadir.\&&datanm&k &Dest_dat.\&&datanm&k; %end; %mend copydat; %copydat; Where: &d_obs = macro variable keeping count of the XPT files found &datadir = macro variable for source location of XPT file. &&datanm&k = macro variable for the name of each XPT file that needs to be copied &dest_dat = macro variable for the destination folder for the transport files. 5
4. CONCLUDING SUMMARY This macro is a critical tool for the programmer. An XPT file can be invoked anywhere in the SAS program and several different SAS XPT files could be called within a single program. As has been shown, the %copy macro counters these limitations by automating the process of accurately tracking, finding and copying necessary submission programs and data files from the assembly area to the submission area. This alleviates the burden on the programmer, and expedites the submission process. Using this tool, a job that would take a whole day can be done in minutes. REFERENCES SAS Macro Language Reference First Edition Copyright 1997 by SAS institute, Cary, NC, USA SAS Institute Inc., SAS Language Reference Version 6 First Edition Copyright 1990 by SAS institute, Cary, NC, USA ACKNOWLEDGMENTS The author greatly acknowledges the thorough review and candid feedback from John Troxell, Donna Usavage, Amy Gillespie, Xingshu Zhu, and James Wu. TRADEMARKS 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 registered trademarks or trademarks of their respective companies. CONTACT INFORMATION Eunice Ndungu Merck & Co. (BL 3-2) West Point, PA 19486-004 (484) 344-7933 E-mail: Eunice_Ndungu@merck.com 6