The SAS Output Delivery System and reporting techniques

How to print a page number (page X of Y) in body part of footnote with rtf tags

Reply
Contributor
Posts: 22

How to print a page number (page X of Y) in body part of footnote with rtf tags

I have to print page number (page X of Y) at body part of the footnote with "line" statement And the page numbers should not change even if I merge/combine the two rtf files.

Please find the below example program. I need alternative RTF tag/tags for yellow colored tag for printing X and it should not change even after combining two rtf output.

ods escapechar='^';

ods listing close;

ods rtf file='myrtf.rtf';

proc report data=sashelp.class;

title 'Page ^{thispage} of ^{laspg}';

%let lastshet=5;

compute after _page_ / left;

      line "Page ^R/RTF'{\chpgn}' of &lastshet";

endcomp;

run;

ods listing;

ods rtf close;

Note: I should use the rtf tags in line statement.

Super User
Super User
Posts: 7,942

Re: How to print a page number (page X of Y) in body part of footnote with rtf tags

Posted in reply to yanamadala85

Hi,

I am afraid the second condition of your request is not possible with tags.  The simple fact is that rtf is text, with tags to describe how to render the text.  When the RTF is loaded, say into Word, the file is interpreted by the RTF parser.  At this point page numbers and such like are calculated.  Hence, if you combine two RTF files, then the page number is calculated "overall".  You could print each RTF file to PDF, then combine those as the print to PDF hardcodes the page numbers into the text.  You can also do this yourself in your code.  Say I have table with 100 rows.  If I fix each page to have 10 rows, then I know that page numbering works 1 of 10 - 10 of 10, and can easliy add this into the data and report it out.  This is again hardcoding the page numbers into the output, so no use of tags for this.

Contributor
Posts: 22

Re: How to print a page number (page X of Y) in body part of footnote with rtf tags

Hi,

In my condition i have to assign page numbers dynamically, I don't have an option to do like the above.

Super User
Super User
Posts: 7,942

Re: How to print a page number (page X of Y) in body part of footnote with rtf tags

Posted in reply to yanamadala85

There is no dynamic tag such as you mention.  If you use the dynamic tags as given, when you combine the RTF files the page numbers will be for the whole document.  You will need to hardcode the page numbers in one way or another to get fixed page numbering.  A document either has dynamic page numbering or fixed page numbering, take your pick.

Contributor
Posts: 22

Re: How to print a page number (page X of Y) in body part of footnote with rtf tags

I am planning to use the below tag but it is not getting resolve, Can you please guide me?

ods escapechar='^';

ods listing close;

ods rtf file='myrtf.rtf';

proc report data=sashelp.class;

title 'Page ^{thispage} of ^{laspg}';

run;

ods RTF TEXT= "^R/RTF'{/sectd /pgnstart}";

ods listing;

ods rtf close;

Super User
Super User
Posts: 7,942

Re: How to print a page number (page X of Y) in body part of footnote with rtf tags

Posted in reply to yanamadala85

You have a typo in that:

ods RTF TEXT= "^R/RTF{'/sectd /pgnstart'}";

Don't think this will help though, it may (you will have to try) reset the page numbering back to 1, but its still a calculated not fixed page numbering.

Ask a Question
Discussion stats
  • 5 replies
  • 1049 views
  • 0 likes
  • 2 in conversation