Download PAGE_COUNT.SAS: The Solution to Customized Pagination of Your PROC REPORT Output

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
PAGE_COUNT.SAS: The Solution to Customized Pagination
of Your PROC REPORT Output
Bryan K Beverly, APACHE Medical Systems, Inc.
Phillip J. Screen, APACHE Medical Systems, Inc.
ABSlRACT
While PROC REPORT is growing in usage as
an alternative to using data nulls, the
procedure is limited by the fact that it does not
provide the pagination flexibility of the DATA
_NULL_ format. In response to a need for
pagination flexibility in dinical trial PROC
REPORT tables, Phillip J. Screen (fomnerty of
Boehringer Mannheim Pharmaceuticals)
developed a program called
PAGE_COUNT.SAS. Utilizing the
SHAREBUFFERS option, this program takes
the output file produced by PROC REPORT,
counts the number of pages and replaces the
file with one in which the pages have been
numbered in a customized format (i.e., PAGE
1 of N).
approaches (i.e., PAGE 1 of N) were often
needed to reflect the current page and the total
number of pages in a set of tables. While
DATA _NULL_ processing provided pagination
flexibility, it could not be used as a PROC
REPORT option.
In an effort to supply the pagination options not
offered by the PROC REPORT procedure,
Phillip J. Screen developed a program called
PAGE_COUNT.SAS (see FIGURE 1). This
code performed three basic functions - it: (1)
retrieved the output produced by the PROC
REPORT procedure, (2) read in the systemdefined carriage control character as a
mechanism to count the number of pages and
(3) placed the numbers onto the output based
upon the location of the word 'PAGE'.
INTRODUCTION
There are three key components of this
program's functionality. The first component is
the SHARE BUFFERS option.
SHAREBUFFERS causes the FILE and IN FILE
statements to share the same buffers during
DATA _NULL_ processing. When using PUT
statements, the information can be written into
specific fields of the the same file instead of
creating an external file.
Since its introduction, PROC REPORT has
steadily grown in usage. The procedure
provides a format that facilitates reporting in a
manner that is less cumbersome than using
DATA _NULL_ processing but more pliant than
the PROC PRINT or PROC TABULATE
procedures.
However, in seeking to use PROC REPORT to
produce dinical trial report tables, it was
discovered that the procedure was rigid in
terms of pagination options. While users had
options in customizing report formats and page
breaks, the method of page numeration was
standardized.
The second component is the carriage control·
character. This character varies by operating
system and can either be created by a word
processing character composition process or
by cutting and pasting the character into the
code.
Not having pagination flexibility was
problematic, particularly in a dinical trial
reporting environment. Typically, one clinical
trial report table could be several hundred
pages long. Since voluminous reports had an
increased risk of having pages either
misplaced or removed, customized pagination
The third component is the report format. The
code needs to find a word or phrase, such as·
'PAGE X of X', in order to insert the current
and total page numbers (see FIGURES 2 and
3). The creation and placement of the word or
phrase can be controlled in a TITLE statement
119
within PROC REPORT.
CONCLUSION
PAGE_COUNT.SAS has proven to be a
viable PROC REPORT supplement and
valuable tool in clinical trial reporting. While at
Boehringer Mannheim Pharmaceuticals where
this code was developed, the authors used
PAGE_COUNT.SAS to paginate output in a
few seconds; normally, a search and replace .
effort for hundreds of pages would have taken
many minutes, if not hours to perform. Hence,
the program virtually repaid the development
time after one usage. With some modification,
this code can make the pagination of any
PROC REPORT output an easy, efficient and
effective task.
ACKNOWLEDGEMENTS
. The authors wish to thank Dr. Eugene R.
Heyman, Director of Biostatistics and Data
Services, Boehringer Mannheim
Pharmaceuticals, for permitting the sharing of
the code. We also thank Ms. Elizabeth A.
Draper, Executive Vice President, APACHE
Medical Systems, Inc. for her support in this
effort.
120
FIGURE 1
/*------*
*
*
*
*
*
*
*
*
*
-----------------------
Program Name: sas6:[utility] PAGE_COUNT.SAS
Date created: 10/22192
By: Phillip J. Screen (Currently of Apache Medical Systems and
formerly of Boehringer Mannheim
Pharmaceuticals where the code was developed)
Date last modified:
By: PJS
Program function: To produce a individual and overall page number counter
for the listings-(proc report produced or any other type}
*
* Files read: drug:[drug.sas]*.Iis
*
* Files created/modified: drug:[drug.sas]*.Iis
*
* Tablelfigs generated:
*
* Subroutines executed:
*
* Modification log:
*-----.. --------------------------------------..- - - - * /
OPTIONS NOFMTERRj
r======= START USER INPUT SECTION
*/
study number
*/
/* obtain the Input listing file name
*/
/* obtain the coIurm number of where the */
/* word PAGE $ of $$ begins
*/
/ * = = = = , = = = END USER INPUT SECTION
*/
%Iet study=j
%Iet ifnlis=bp_listj
%Iet colpage=20;
r
%Iet proj=%substr(&study,1,3}j
/* get directory name from &study
filename in "&proj.:[&study..sas]&ifnlis..Iis";
r
data _nulL;
infile in end=eof;
input@1 cchar$1. @;
retain n OJ
r read in the rlSting file and collect the
r total page number count
if cchar='carriage control charactel then do;
n=n+1;
output;
end;
if eof then do;
call symput('totn',left(n»;
endj
*/
define the location of the listing
r
In a macro (&totn)
r
r
main counter based upon caniage
r
collects total count at end of file
control
121
*/
*'
*/
*/
*'
*/
run;
%put the value of macro totn is &totn;
/* detennine if the macro resolved
data _nulL;
1* obIain the final output listing file··
infile in sharebuffers;
file in ;
input @1 cchar $1.
@&colpage page $5.
@&colpage text2 $16. ;
retain n 0;
if compress(page)='PAGE' then do;
o=n+1;
text2=(,PAGE'II' 'licompress(N)II' 'II'OF 'licompress('&totn'»;
put @&colpage text2 $16. ;
end;
run;
*/
*/
/*--------------------*/ ENDSAS; / *----------------------*/
122
FIGURE 2 • PROC REPORT Output Before Using PAGE_COUNT.SAS
PAGE Xof X
Blood Pressure Report
Patient ID Number
~
IV
w
Systolic Blood Pressure
Diastolic Blood Pressure
1000
120
93
2000
105
72
3000
176
89
4000
203
99
5000
146
75
FIGURE 3 - PROC REPORT Output After Using PAGE_COUNT.SAS
PAGE 1 of 100
Blood Pressure Report
Patient 10 Number
~
...
IV
Systolic Blood Pressure
Diastolic Blood Pressure
1000
120
93
2000
105
72
3000
176
89
4000
203
99
5000
146
75