The SAS Output Delivery System and reporting techniques

Can anyone please provide me suitable RTF Tag

Reply
Occasional Contributor
Posts: 17

Can anyone please provide me suitable RTF Tag

I am using The below RTF tag to print the page number(page x of y) in the body part of the RTF file.
   Page ^R/RTF'{\chpgn}' of &laspg

Note: &laspg is the macro variable which i have assigned to the value for Y calculation and i do not have problem with this. I have a problem with '{\chpgn}' tag. Because after merging the two rtf files, page numbers which are present at the body part of the rtf files were changing, I wanted page numbers should not be change at body part of the footnote even after combining the two or three rtf outputs.

With thanks

venkatesh

Valued Guide
Posts: 3,206

Re: Can anyone please provide me suitable RTF Tag

check RTF specs at: Appendix B: Index of RTF Control Words

---->-- ja karman --<-----
Grand Advisor
Posts: 17,428

Re: Can anyone please provide me suitable RTF Tag

So you have a program that generates Page X of Y notations, using RTF tags where the X is \chpgn and is an RTF tag.

It works if you export a single document.

When you then merge that document into another document, into the middle or end I'm assuming, the page is automatically updated to reflect the current position in the document. This makes perfect sense since the RTF tag is \chpgn uses the current page number.

If I was doing this manually, I would create different sections and there's an option for separate page numbering for each section so I would fix my merging of documents so that each was it's own section and that might avoid this problem. 

Other things to try are for the first page:

\pgnstartN


Or use

\Sect

in your RTF code to create an RTF that has a unique section. 

You may need a combination of the above to get it to work.

Hope that helps.

Occasional Contributor
Posts: 17

Re: Can anyone please provide me suitable RTF Tag

Hi Reeza,

Thank you for you valuable suggestion, I think it would solve my problem.

In your answer you have mentioned about an"option for separate page numbering for each section", Could you please explain about it and how can I use with an example.

With thanks,

Venkatesh

Grand Advisor
Posts: 17,428

Re: Can anyone please provide me suitable RTF Tag

That depends on how you're combining your files.  If it was in MS Word you could create a Section Break before each section. 

For SAS you could try adding the /sect tag at the beginning of your report.

Occasional Contributor
Posts: 17

Re: Can anyone please provide me suitable RTF Tag

Please find the below and provide the alternative tag for Page X, that tag must resolve in line statement of compute block.

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;

Occasional Contributor
Posts: 17

Re: Can anyone please provide me suitable RTF Tag

Hi Reeza,


\pgnstartN

\Sect                tags are not resolving in the compute block.

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'{\pgnstartN}' of &lastshet";

endcomp;

run;

ods listing;

ods rtf close;

Esteemed Advisor
Esteemed Advisor
Posts: 7,250

Re: Can anyone please provide me suitable RTF Tag

Why not just fix it yourself in the data prior to output?  E.g. in your output dataset:

X     Y     Z     Page     Of

X     Y     Z     1           10

X     Y     Z     1           10

X     Y     Z     1           10

X     Y     Z     2           10

Then you can achieve your desired output by using proc report, breaking after Page.

Occasional Contributor
Posts: 17

Re: Can anyone please provide me suitable RTF Tag

it may solves the problem, but I in my condition I am assigning page values dynamically and I have a calculated program for Y. Only option I have is to use rtf tag for printing of X.

Grand Advisor
Posts: 17,428

Re: Can anyone please provide me suitable RTF Tag

So I tried it manually, e.g. by creating some individual RTF files and then appending them and seeing what tags I needed to get the page numbers in each section to start renumbering.  You can do the same to see what tags you need.

It looks like you need a /sect AND /sectd /pgnstart to set each section of your code, this does not become part of your Proc Report code, that stays the same.

The code below isn't exact and is untested but I think it should look something like

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

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

proc report code....

run;

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

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

Ask a Question
Discussion stats
  • 9 replies
  • 846 views
  • 0 likes
  • 4 in conversation