The SAS Output Delivery System and reporting techniques

PAGE NUMBERING

Reply
Occasional Contributor
Posts: 14

PAGE NUMBERING

I need to create a pdf and a rtf file with two kind of numbering:

the page number respect to the entire document and

the page number respect to the table (for the tables that last more than 1 page).

 

Is that possible? how to deal with this in the report code?

 

Thanks a lot

 

Barbara Pomili

Occasional Contributor
Posts: 18

Re: PAGE NUMBERING

[ Edited ]

Hi Barbara,

 

Here is a paper that talks about how to create page numbers with ods output. http://support.sas.com/resources/papers/proceedings11/263-2011.pdf

 

There is an example of how to create them as a title. The code is as follows using the ods escapechar option.

 

OPTIONS NONUMBER;
ODS ESCAPECHAR='^';
title justify=center 'Data Set CLIPS'
 justify=right 'Page ^{pageof}'; 

 Hopefully this helps you out. 

SAS Super FREQ
Posts: 8,645

Re: PAGE NUMBERING

Hi:

I think the challenge that the OP will ultimately face is that the usual {thispage} and {lastpage} ESCAPECHAR functions only work with the page numbering for the total number of pages in the document (not the number of pages relative to each table. (BTW, {pageof} only works for RTF, not for PDF, but {thispage} and {lastpage} work for both RTF and PDF destinations.)

 

  That means for page x of y -- x is the current page and y is the number of pages in the entire document.

 

  For example, in the code below, multiple pages are printed for SASHELP.HEART and SASHELP.SHOES and you can see at the "change" between the procedures that it was possible to reset the starting value for {thispage} but not for the ending value of {lastpage}.

 

cynthia

 

here's the code:

title; footnote;
ods escapechar='^';

options pageno=1;
ods rtf file='c:\temp\multpages.rtf';
ods pdf file='c:\temp\multpages.pdf';

title j=c "SASHELP.HEART" j=r 'Page ^{thispage} of ^{lastpage}';
proc print data=sashelp.heart(obs=100);
  var sex status ageatstart diastolic systolic;
run;
title;
 
options pageno=1;
ods rtf;
ods pdf;

title j=l 'Page ^{thispage} of ^{lastpage}' j=c "SASHELP.SHOES";

proc print data=sashelp.shoes(obs=150);
  var region product sales inventory;
run;

ods _all_ close;
title;

and the output (top output is PDF, bottom output is RTF):

using_page_numbering.png

Post a Question
Discussion Stats
  • 2 replies
  • 145 views
  • 1 like
  • 3 in conversation