BookmarkSubscribeRSS Feed
FlimFlam
Calcite | Level 5

Hi everyone,

 

I'd like to modify some of the events in the RTF tagset via PROC TEMPLATE in SAS 9.4 by creating a new tagset and setting the PARENT to RTF (similar to what's outlined here: http://support.sas.com/documentation/cdl/en/odsug/61723/HTML/default/viewer.htm#a002285940.htm.)

 

As a first step, I decided to try creating a new tagset that fully inherits the RTF tagset (no modifications.) I used the following to do that:

 

PROC TEMPLATE;
     DEFINE TAGSET TAGSETS.RTF_MOD /STORE=SASUSER.TEMPLAT;
     PARENT=TAGSETS.RTF;
     END;
RUN;

The TEMPLATE code above ran without any problems, but when I attempt to use the new TAGSETS.RTF_MOD, I get strange results. Here's the code I used to try creating a new RTF using the RTF_MOD tagset:

 

ODS TAGSETS.RTF_MOD FILE = '[Output directory]\Testing.rtf';
ODS TEXT = 'TESTING 123';
ODS TAGSETS.RTF_MOD CLOSE;

And here's the output I got in my "Testing.rtf" file (when viewed through MS Word):

 

{\fonttbl

}

{\colortbl;

}

{\*\bkmkstart IDX}{\*\bkmkend IDX} }

 

It looks like perhaps the RTF control words are being saved as plaintext, rather than as an RTF - am I missing something in my code above? If I use the same ODS code as above, but change the destination from RTF_MOD to RTF, then the RTF file is created correctly. Not sure what I'm doing wrong....

 

Any insights are appreciated - thank you in advance!

3 REPLIES 3
Cynthia_sas
SAS Super FREQ
Hi:
First, I would not really recommend this if you are not very comfortable with both RTF control strings and RTF command syntax and with PROC TEMPLATE.

The reason I say this is that if you have 1 single mismatched { or } the RTF file will become unreadable/unrender-able by a word processor.

So what is the modification you want to implement? Can you elaborate? Is it primarily a style change or do you actually want to modify the RTF control strings that are generated?

In fact, the example you posted is about making an HTML modification to the HTML tags. HTML in a browser is WAY, WAY more forgiving than RTF in a word processor when being rendered.

And, I'm not actually sure that just having a PARENT= statement will work for TAGSET templates. I think you have to have some events, but I'm not sure which ones.

This seems, to me, to be to be a question for Tech Support.

cynthia
FlimFlam
Calcite | Level 5

Hi Cynthia,

 

Thanks for the quick reply!

 

After I posted this, I did a little more digging, and eventually found what I was looking for: http://support.sas.com/kb/45/138.html.

 

After copying that code in, I re-implemented the events that I wanted to, and now everything works like a charm!

Rajaram
Obsidian | Level 7

Hi FlimFlam

 

Thank you very much. I was looking for this long time. I have written to SAS Support last month still no answers. I followed link which you have added. It is working fine now :smileyhappy 🙂

 

Regards

Rajaram

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1304 views
  • 1 like
  • 3 in conversation