| Date: | Mon, 3 Aug 1998 14:47:15 -0400 |
| Reply-To: | "Rhoades, Stephen" <rhoadsj@COGNIZANTCORP.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU> |
| From: | "Rhoades, Stephen" <rhoadsj@COGNIZANTCORP.COM> |
| Subject: | Page Number Report Header |
| Content-Type: | text/plain |
|---|
My assumption is that your are using Multiple DATA _NULL_ routines for
these multiple reports. If so, I would suggest using the PAGENO= system
option.
EX:
DATA _NULL_;
.
.
.
Options PAGENO=1; /* To reset before next report*/
RUN;
DATA _NULL_;
.
.
.
Options PAGENO=1; /* Again reset before nex report */
Regards;
S. Rhoades
[This followup was posted to comp.soft-sys.sas and a copy was sent to
the
cited author.]
In article yklein@j51.com says...
In your posting, you say...
> I am using proc _null_ to generate multipage reports. I use the
Header:
> to generate sequential page numbers at the top of each page. However,
> the report specification is to put: "Page n of N" at the top of each
> page, where N is the number of pages in the report.
>
> I would appreciate any suggestions on how to generate the value of N
for
> this report.
>
> Thanks.
> Yehuda Klein
>
Basically what you need to do is use PROC PRINTTO to write your output
to
a file, read in back in to count the pages, and then print it again with
the N inserted in your title.
Here's some rough code:
proc printto print='c:\temp.txt' new; run;
options ps=90;
title 'Page @@@ of (###)';
* put your procedures here;
proc printto; run;
data _null_;
retain pgcnt 0;
infile 'c:\temp.txt' lrecl=90 end=eof missover pad;
input line1 $90.;
if index(line1,"###")>0 then pgcnt+1;
if eof then call symput("totpage",left(put(pgcnt,3.)));
run;
data _null_;
retain pgcnt 0;
infile 'c:\temp.txt' lrecl=90 end=eof missover pad;
input line1 $90.;
if index(line1,"###")>0 then do;
pgcnt+1;
substr(line1,index(line1,"@@@"),3)=put(pgcnt,$3.);
substr(line1,index(line1,"###"),3)=&totpage;
end;
file 'c:\temp2.txt' lrecl=90;
put line1;
run;
*this code will put your revised output in the file temp2.txt;
*the only tweaking you may need to do is to replace the value 90 with
the
appropriate linesize for your output. Notice that the value 90 is used
in several places. Also, this code is set up for 3-digit page numbers,
if
you need more digits, add more @ and # signs and change the $3. and 3.
formats as needed.;
|