Is there a way to get SAS not to insert the text inside a table when using the ODS RTF TEXT=""; statement? with the minimal example below, the "Text here" is included in a table cell, which makes it more difficult to manage page breaks, text flow, etc.
The table is revealed by setting the "View Gridlines" button in the Tables/Layout menu of recent versions of Microsoft Word.
ods rtf file="sasmeas.rtf"; ods rtf text="Text here"; proc datasets lib=work; quit; ods rtf close;
In SAS 9.4 Windows.
Why do you want to use rtf text? That inserts text into the body of the document. If you want text outside, use titles (yes, you should be able to tell it not to use them as titles in the Word context - I think its: options bodytitle; ). To be honest i have never found a use for the "ods text"
Using titles is indeed a good solution. In this case what I wanted to add was a table of contents after a cover page. The OPTIONS CONTENTS always puts the table of contents in the first page, and I didn't want to go into the issue of merging RTF documents in SAS, as the solutions that I've found are rather ugly.
Ah, I see. Yes this is a problem. Its not really SAS's fault though, RTF is quite an old spec, and when you open it your using a new version of Word, so Word is the renderer - its reads the RTF code and renders it. So your stuck between 3 places: SAS - which admittedly doens't have the tools to build complicated documents (proc document was a move towards that, but still not as easy to use or fully functional), RTF spec - old, so doesn't have all the modern functions, and Word - which has its own unique way of working (yes, you can read that last text as its really awful to use).
So from the above I wouldn't recommend RTF as being the final document. Get a nice PDF builder tool, and you would be able to combine all the RTF files in one PDF (which saves space), and you can add bookmarks, table of contents and such like in quite easily. I understand its nice to do things all in one, but this is one instance where having a tool for the job is the best method - we have a whole team that build large PDF files, from combinations of documents, RTF's from us, and other things, building TOC.
Instead of ODS RTF use
ODS tagsets.RTF file="your file.rtf" options(Tables_off='USERTEXT');
Which will do as you requested. There may be issues if you use other Ods RTF options like body_title and keepn which may not work at all or differently.
don't forget to close ODS tagsets.rtf not Ods rtf.
Thanks, this is good to know. I don't really like how TAGSETS.RTF issues some of the page breaks, and for the project I am working on prefer the way that ODS RTF does (i.e., it doesn deal with it). Is there a way to turn off the breaking of pages in TAGSETS.RTF? I couldn't find any, though I imagine that I could set the height of the page to be very long, and then reduce it Microsoft Word.
Supposedly tagsets.RTF is too allow you more control of the output than ODS RTF but I too have had issues with other things not working with this tagset.
You might try the option PagePanels=None. The documentation claims that this should handle paneling (tables on pages) the same way as Ods Rtf. The default for the dataset is PagePanels=0. Or specify a number of tables (good luck with those results unless you know how many lines each of your tables works) . Like the ods rtf startpage you chang change this setting in mid-document to change behavior so may be worth experimenting. Working with option TABLEROWS=n may help this work out. Tablerows.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.