The SAS Output Delivery System and reporting techniques

ODS RTF and Bodytitle

Accepted Solution Solved
Reply
Contributor
Posts: 25
Accepted Solution

ODS RTF and Bodytitle

 

When I run an ODS RTF statement without Bodytitle, I get what I expect (the "Update Field" option in Word, for creating a Table of  Contents); when I include Bodytitle, the "Update Field" option isn't available - am I missing something? (I'm using SAS 9.4)

 

 

data test;
input name $ count;
cards;
A 1
B 2
;
run;
/* without Bodytitle*/
ods rtf file='C:\temp\TEST1.rtf' contents toc_data ;
/* with Bodytitle*/
ods rtf file='C:\temp\TEST1.rtf' contents toc_data bodytitle;

proc report data=test;
column Name count;
define name/ group ;
define count /display;
run;
ods rtf close;


Accepted Solutions
Solution
‎02-22-2016 10:02 AM
Contributor
Posts: 25

Re: ODS RTF and Bodytitle

Got a solution from SAS Tech Support:

 

You can view and update the table of contents created with BODYTITLE by selecting the entire document (Ctrl+A) and pressing F9.

 

(it works!)

 

 

View solution in original post


All Replies
Esteemed Advisor
Esteemed Advisor
Posts: 7,253

Re: ODS RTF and Bodytitle

Well, let me start by saying that RTF != Word.  RTF is text markup, i.e. it is text with codes which certain programs can read and interpret.  When you open and RTF file in Word, Word initiates its RTF parser software, parses the file and then decides how to render the text.  Now Word is maliciously bad at these types of things, press delete foro instance on a subheading and suddenly the whole document's titels change font for instance.  Unless your an expert at Word it is rare to find a solution to it.  

Now to your question, bodytitle - this is an option to put titles in either the title section of Word, or, with the option bodytitle, to include that text as headings in the text of the document - i.e. you don't have titles then.  How does Word do its table of contents (well who knows, I sure have never worked it out), but I imagine it links the document object - checks titles and headings, and makes its best guess.  Personally, I would never rely on Word to create contents tables.  

One thing I can suggest you do is to open the two files, one with bodytitle and one without in a proper text editor (Notepad++ for instance), and have a look at what tagset output is being created.  Find the text of the titles and you will see they either appear in different places, or have different tags surrounding the title (or both), which means the RTF parser in Word will treat these as different.

Solution
‎02-22-2016 10:02 AM
Contributor
Posts: 25

Re: ODS RTF and Bodytitle

Got a solution from SAS Tech Support:

 

You can view and update the table of contents created with BODYTITLE by selecting the entire document (Ctrl+A) and pressing F9.

 

(it works!)

 

 

Esteemed Advisor
Esteemed Advisor
Posts: 7,253

Re: ODS RTF and Bodytitle

Yes, that is a manual step to do it.  What happens when you save that file though, do you save back to RTF and possible have to do it again, or save as Word etc.  

Contributor
Posts: 25

Re: ODS RTF and Bodytitle

After the Control-A / F9, I saved it as a Word doc, and the TOC is there when I re-open it (don't have to do it again)

Thanks,

Dave

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 627 views
  • 0 likes
  • 2 in conversation