The SAS Output Delivery System and reporting techniques

Special first and last page in PROC REPORT

Posts: 21

Special first and last page in PROC REPORT

Using: PROC REPORT, PDF output destination, SAS 9.4:


  • How do you suppress the page number on the first page?  (i.e., cover/title page)
  • In a compute after _page_ block, is there a way I can suppress this on the last page?  For example, I wanted to have a line text that says "See footnote at the end of the report."  Do I need some kind of page counter to keep track?  (I have a compute after block to print the endnote.)  Currently, the line text from both blocks appear on the last page when I only want the text from the compute after on the last page.

Thank you.

Posts: 9,367

Re: Special first and last page in PROC REPORT

If you are writing your text with a LINE statement in a COMPUTE block, you can use a technique like this:
compute after;
if <some condition> then do;
txtvar = ' ';
lg = 0;
else do;
txtvar = 'whatever text';
lg = length(txtvar);
line txtvar $varying. lg;

So if you can code a condition that indicates the end of the table/report, then you can assign the LENGTH variable a value of 0 (in the above pseudo-code it is LG) -- any LINE statement that uses $VARYING and a length of 0 is suppressed.

You can't execute a LINE statement conditionally. So this is a reason that the TXTVAR is holding the string to be printed - -but when your end of table/report condition is reached, then the LG variable is assigned a value of 0.

Hope that makes sense. There are some examples in the documentation for PROC REPORT. But you can also find an example starting on page 14 of this paper from 2011:

For your first question, the issue is that you can only alter the page numbers at a procedure break. So normally, if you are creating PDF output, you do the "first page" with the NONUMBER option in effect; and then you have a second step that does the report for all subsequent rows using a combination of FIRSTOBS= and NUMBER and PAGENO=2 values for the options so that numbering starts at page 2 (or whatever the number is that you start).

Super User
Posts: 10,770

Re: Special first and last page in PROC REPORT

Yes. I think You need some kind of page counter to keep track . ( with the help of $varying.)
Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation