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.
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.
Hi,
In my condition i have to assign page numbers dynamically, I don't have an option to do like the above.
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.
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;
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.
title 'Page ^{thispage} of ^{lastpage}';
works fine for me (in RTF of course).
Hi:
You are using "old" pre-9.2 version syntax for inserting "raw" RTF control strings into your output. I do not know how long this older syntax will be supported. As you have been advised, when ODS makes an RTF file using your "raw" strings, ODS is just inserting control strings into an ASCII text file.It is up to the Word Processor that opens the RTF file to use the control strings as designed.
If you combine the 2 RTF files, the word processor that renders the RTF control strings will "resolve" the page numbering controls. It is likely that the page numbers will change based on the way that the word processor renders the page controls. But if you have one RTF file with 10 pages that initially shows page 1 of 10 and a second RTF file that initially shows page 1 of 15, when you combine those files, the first pages, from the first RTF file will probably show 1 of 25 and the second RTF file, now combined with the first will probably show page 11 of 25. If I understand what you are trying to do, you cannot use RTF control strings with ODS to "freeze" the page numbers and bypass how the word processor will treat the RTF controls.
Cynthia
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: