Date: Tue, 16 Jul 1996 16:32:39 EDT
Reply-To: whitloi1@WESTATPO.WESTAT.COM
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Ian Whitlock <whitloi1@WESTATPO.WESTAT.COM>
Subject: Re: Keeping Page#s across PROC PRINTTO
Subject: Keeping Page#s across PROC PRINTTO
Summary: It's a kludge.
Respondent: Ian Whitlock <whitloi1@westat.com>
Andy BARNETT <barnetta@PPDI.COM> asks
>Does anyone know how to get the current PRINT page number, so that it
>can be saved prior to a "PROC PRINTTO PRINT=...; RUN; OPTIONS
>PAGENO=1;" and restored afterwards -- something akin to:
>
>%let savepage = &syspage;
>proc printto print = ...; run;
>options pageno = 1;
>...
>proc printto; run;
>options pageno = &savepage; /* or would that be %eval(&savepage+1)? */
SAS was originally designed to do away with developers not encourage
them, hence there was little need to support this sort of thing. SI
may have changed their policy many years ago, but developer support in
the basic language is still rather weak.
However, you can make a kudge. Write a new page to some new printto
file. Read it and save the page number. This is the number to begin
with when you want to resume. Here is some code to play with.
options number pageno = 20 date ;
filename chk 'c:\sasl\junk\junk.dat' ;
data _null_ ; /* test */
file print ;
do i = 1 to 5 ;
put ' ' / _page_ ;
end ;
run ;
/* dummy print to get page number */
proc printto print = chk new ; run ;
data _null_ ;
file print ;
put ;
run ;
proc printto ; run ;
filename chk clear ;
filename chk 'c:\sasl\junk\junk.dat' ;
data _null_ ;
infile chk truncover ;
input line $char132. ;
pg = reverse ( scan ( reverse ( line ) , 1 ) ) ;
call symput ( 'syspage' , trim ( pg ) ) ;
stop ;
run ;
%put Return to syspage=&syspage after work below ;
proc printto print = chk new ; run ; /* may want different file */
options pageno = 1 ;
Ian Whitlock