BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I want to display page number in each page of my text report in footer.
how can get total number of pages so that i can display page 1 of 4 if my total number of my pages is 4
i am using proc report to generate a text file
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi, Sunil:
Page numbers do not "belong" to particular SAS procedures. You can sometimes use commands or statements or options inside various procedures to cause a "page eject", but the page numbering itself is controlled by system options, not by the procedures. Page numbers belong to the overall type of output file that is being created. So, for example, HTML output does not use any SAS page numbers, because page numbers are irrelevant in the "paperless" office (seriously, though, HTML just doesn't have anything in the specification for page numbering).

If you are sending output to the LISTING destination or a LISTING file, then you get page numbers by default in the upper right-hand corner of the LISTING file that you're creating (this page number is a single page number and is controlled by the NUMBER and PAGENO system options).

If you are sending output to the RTF or PDF destination, then you can get page numbers using either the default SAS numbering (which is just a number) or using special ESCAPECHAR (escape character) functions to get Page X of Y page numbering, as described in this previous forum posting:
http://support.sas.com/forums/thread.jspa?messageID=6931ᬓ

This previous posting shows both a program code method and an EG method to insert Page X of Y page numbering into your EG (RTF and PDF) output.

If you are generating an ASCII text file, using DATA _NULL_ techniques and you wish to put carriage control characters and page numbers into your output in Page X of Y format, then you will have to make 2 passes through your output. You'd have to create the output and capture the total number of pages and then in the second pass, you'd have to alter the page number to be in the form you wanted, making sure that you did not accidentally change any options that would change the number of total pages produced. The previous posting also shows a link to a user-defined routine that is supposed to produce Page X of Y page numbering even in the LISTING output.

For more help with this question and the correct solution, I highly recommend that you contact Tech Support.

cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1 reply
  • 690 views
  • 0 likes
  • 2 in conversation