BookmarkSubscribeRSS Feed
CurtisER
Obsidian | Level 7

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.

2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
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;
end;
else do;
txtvar = 'whatever text';
lg = length(txtvar);
end;
line txtvar $varying. lg;
endcomp;

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:
https://support.sas.com/resources/papers/proceedings11/246-2011.pdf

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).

HTH,
cynthia
Ksharp
Super User
Yes. I think You need some kind of page counter to keep track . ( with the help of $varying.)

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 3550 views
  • 0 likes
  • 3 in conversation