Desktop productivity for business analysts and programmers

Continuation message wanted for Proc Print output pages

Reply
N/A
Posts: 0

Continuation message wanted for Proc Print output pages

Background:
First step is doing a Proc Tabulate to generate the report data, which is grouped by (class) the School Name which will total the amount of $$ for each school and the Percentage of Total $$.
Then a Proc Sort is done to put the result data into order by decending value by Percentage of Total field.
Then the Proc Print is done to print the results.

Prior to this month, the results all fit on one page, and now it spans 2+ pages. The user wants a "Continued on next page" message at the bottom of a report on page 1.

I tried a Footer, but that also prints on the last page as well. Any ideas on how to get a message/footer on all but the last page of an output report?
SAS Super FREQ
Posts: 8,819

Re: Continuation message wanted for Proc Print output pages

Hi:
What is your destination of interest: ODS HTML(browser), ODS RTF (Word), ODS PDF (Acrobat Reader)???

When you say that prior to this month the results all fit on one page, do you mean that the TABULATE, AND the PRINT fit on one page??? Normally, there would be a page break between the TABULATE and the PRINT.

Can you post all your code, including ODS statements.

But in the meantime, one suggestion is a simple solution to use TAGSETS.RTF, which automatically puts a "(Continued)" message, as shown in Word if you run the program below. (Note that you need SAS 9.2 to use TAGSETS.RTF destination.)

cynthia
[pre]
ods listing close;
ods tagsets.rtf file='c:\temp\output\show_continued.rtf';

proc print data=sashelp.shoes(obs=75);
title 'Show continued';
var region subsidiary product sales inventory;
run;
ods tagsets.rtf close;
[/pre]
N/A
Posts: 0

Re: Continuation message wanted for Proc Print output pages

Currently have SAS 9.1 (will be updating to 9.2 in a few months) Output is PDF - You are correct, the EG output is multiple pages with the Tabulate data first, then the Print data following, but the Proc Print also creates an external output file on the server that we later send via email to necessary customers. It's on this external file that the continue message is needed. Here's the code:

PROC TABULATE
DATA=&lib..&workfilename out=&lib..&REPORT13out&monthname

;
VAR Input_CPB;
WHERE Note_Status not in ('PP','P');
CLASS School_Name / ORDER=UNFORMATTED MISSING;
TABLE /* Row Dimension */
School_Name={LABEL='School Name *'}
,
/* Column Dimension */
Input_CPB={LABEL=''}*
N={LABEL='Number of Loans'}
Input_CPB={LABEL=''}*
Sum={LABEL='Outstanding Principal Balance'}*F=DOLLAR17.2
Input_CPB={LABEL=''}*
PctSum={LABEL='Percent of Loans by Outstanding Balance'}
;
;

RUN;

proc sort data=&lib..&REPORT13out&monthname;
by descending Input_CPB_PctSum_0;
run;

options ls = 85 ps = 66 nodate nonumber ORIENTATION=portrait;

proc print data=&lib..&REPORT13out&monthname noobs label ;

var School_Name
Input_CPB_N
Input_CPB_Sum
Input_CPB_PctSum_0;

label Input_CPB_N = 'Number of Loans'
Input_CPB_Sum = 'Outstanding Principal Balance'
Input_CPB_PctSum_0 = 'Percent of Loans by Outstanding Balance'
School_Name = 'School Name';


sum Input_CPB_N Input_CPB_Sum Input_CPB_PctSum_0;

format Input_CPB_N Comma12.0 Input_CPB_Sum DOLLAR17.2 Input_CPB_PctSum_0 pct_fmt.;

ods escapechar='^';
ods pdf body="&ReportPath&Report13"
style=styles.test;

title1 justify=left '^S={preimage="e:\NYHELPS Folder\hesclogo.gif"}'
justify=right"&end_of_month"
;
title2 justify=center "&line1";
title3 justify=center "&line2";
title4 ' ';
title5 justify=center "Distribution of Loans by College";
title6 justify=center "&line4 " "&line4b";

footnote1 justify=left height=1 "Percentages may not add to 100.00% due to rounding.";
footnote3 justify=left height=2 "HE6124(10/2010)"
justify=center "NYHELPs Report 13 "
justify=right "&foot2 " "&rundate";
run;
ods pdf close;

Message was edited by: jcakers Message was edited by: jcakers
N/A
Posts: 0

Re: Continuation message wanted for Proc Print output pages

It would also be acceptable to use a "Page x of x" printed at the bottom of every page instead of a continuation message. Message was edited by: jcakers
SAS Super FREQ
Posts: 8,819

Re: Continuation message wanted for Proc Print output pages

Hi:
Page X of Y is easier to achieve in earlier versions of SAS, especially since you want PDF. Since you are already using ODS ESCAPECHAR, this should work, but only if you do not have the logo in the title:

[pre]
footnote j=r 'Page ^{thispage} of ^{lastpage}';
[/pre]

The reason I said that about the logo in your title is that per this Tech Support note, you can't have a PREIMAGE and a ^{lastpage} used:
http://support.sas.com/kb/34/573.html

Alternately, you could split the file for PROC PRINT into "chunks" and change the footnote statement accordingly as shown below. Pages 1 and 2 get 28 obs each, with the logo (on my system, with the current size of Kermit.GIF image. so the first PROC PRINT will create a report for obs 1-56 with the footnote of (Continued) and then the last bit, obs 57-70 will get done with a report that has a "blank" footnote.

cynthia


[pre]
title; footnote;
options nodate number pageno=1 center;

ods pdf file='c:\temp\img_and_continued.pdf' notoc;
ods escapechar='^';
title j=l "^S={preimage='c:\temp\kermit.gif'} " j=c "Kermit";
footnote j=l '(Continued)';

** You could write a macro program to generate the first proc print;
** with the appropriate firstobs= and obs= values;
proc print data=sashelp.shoes(firstobs=1 obs=56);
run;

** then your last proc print would be with a "blank" footnote;
proc print data=sashelp.shoes(firstobs=57 obs=70);
footnote ' ';
run;

ods _all_ close;
[/pre]
N/A
Posts: 0

Re: Continuation message wanted for Proc Print output pages

Thank you. The footnote j=r 'Page ^{thispage} of ^{lastpage}'; works great.

I just couldn't find in the documentation how to indicate the values for thispage and lastpage in your statement.
SAS Super FREQ
Posts: 8,819

Re: Continuation message wanted for Proc Print output pages

Hi:
Glad it worked for you.

You do not actually need to provide the values. Once you "declare" your ESCAPECHAR:
[pre]
ods escapechar='^';
[/pre]

When you use the special {thispage} and {lastpage} ESCAPECHAR controls with the declared character (as in a title statement):
[pre]
footnote j=r 'Page ^{thispage} of ^{lastpage}';
[/pre]

Then your paged destinations (PDF and RTF) will substitute the correct page numbers for those special strings once the output file is rendered by Adobe Acrobat Reader or by a word processor, like Microsoft Word. The current page and last page values come from Word for RTF and are calculated by SAS for PDF -- you do not specify the values.

cynthia
Ask a Question
Discussion stats
  • 6 replies
  • 251 views
  • 0 likes
  • 2 in conversation