BookmarkSubscribeRSS Feed
shirinkumar_shah
Calcite | Level 5
Problem Description:
I'm creating tables using PROC TABULATE and have set up a footnote stating 'Page x of y' using the ODS ESCAPECHAR functionality. 'Page x of y' for each table is independent of the other tables - e.g. if I have 3 tables each of 2 pages, then the footnote will be Page 1 of 2 & Page 2 of 2 for each of the 3 tables.

The resulting tables are output to one PDF file.
I want to maintain the page numbering for each table independent of the others i.e. Page 1 of 2, Page 2 of 2 rather than Page 1 of 6 etc..

Is there a way of resetting the page numbering for each new PROC TABULATE within the ODS PDF statements?
I can reset the current page number using OPTIONS PAGENO=1 in between each PROC TABULATE, but this doesn't solve the resetting of the {lastpage} value.

The code below is just a PROC PRINT of the SASHELP dataset CLASS to get my point across. This has output Page 1 of 2 and Page 2 of 2, but really I would want Page 1 of 1 for the first PROC PRINT and Page 1 of 1 for the second PROC PRINT.
3 REPLIES 3
Andre
Obsidian | Level 7
Shah
It seems that the of is always aligned with the total number of pages of your entire document
Andre

even with the following try
[pre]
ods rtf file="test.rtf";
title justify=right ' ^{thispage} ';
proc print data=sashelp.class;
run;
options pageno=1;
proc print data=sashelp.class;
run;
options pageno=1;
footnote "proc print ^{pageof} ";;
proc print data=sashelp.class;
run;
ods rtf close;

[/pre]
shirinkumar_shah
Calcite | Level 5
Hi Andre,
Thanks for your quick response, meanwhile i have managed to get what I was looking for in RTF format, but my goal is to gate the same in PDF.
Can you please help me on this.


ods rtf file="C:\section.rtf"contents=yes;
* Create in table page numbering within the document;
ods rtf sectiondata="\pgnrestart\pgnstarts1";
proc print data=sashelp.class ;
title '{Page \field{\*\fldinst { PAGE \\* MERGEFORMAT }}} of {\field
{\*\fldinst SECTIONPAGES \* MERGEFORMAT } in this section}';
run;
proc print data=sashelp.shoes ;
title '{Page \field{\*\fldinst { PAGE \\* MERGEFORMAT }}} of {\field
{\*\fldinst SECTIONPAGES \* MERGEFORMAT } in this section}';
run;

ods rtf close ;

Shirin
Andre
Obsidian | Level 7
Shah
rtf internal encoding applies only to rtf
if you get the correct presentation in rtf, you may perhaps
export it directly from Open office or
indirectly from MSWord (with pdf creator printer) to pdf?

Andre

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 3 replies
  • 1730 views
  • 0 likes
  • 2 in conversation