The SAS Output Delivery System and reporting techniques

Include external tables in RTF ODS??

Occasional Contributor
Posts: 12

Include external tables in RTF ODS??

I use ODS RTF to create tables.  After that, I must include other rtf-tables (which were not produced in SAS) in rtf - document by hand.  Is that possible to automize this in SAS? And if so how?



Posts: 8,744

Include external tables in RTF ODS??


  The RTF specification is very strict about the opening and closing RTF control strings, including the lists or indices that control colors and fonts. Because of this, what you want to do is not a trivial task. Even if you could combine the files, one created with SAS and the other created by some other method, it would be very easy to get two conflicting sets of opening control strings strings and consequently cause the output tables to either not look right (the best case) or create a corrupted and unopenable RTF file (the worst case). An RTF file can only have 1 set of opening controls and one set of closing controls and you would have to know the RTF specfication very, very well to be able to automate the process and write a program to strip out the table and only the table from the non-SAS RTF file -- but that would probably mean that even if you could strip out the table, you would probably lose any special formatting that the table had.


  One alternative that might work would be to write a VBA or Word macro to open the SAS RTF output into Word, and then open the other RTF document and use VBA commands to cut and paste from one file into the other. I'd then recommend resaving the whole (new and combined) file as a Word.doc file.


Posts: 7,364

Include external tables in RTF ODS??

While Cynthia is probably right (as she usually is), I did come across the following Pharmasug paper that might provide you with a method for accomplishing the task:

Super User
Posts: 10,538

Include external tables in RTF ODS??

Once upon a time I had a loosely related project that involved placing lots of external data into a Word document. You don't mention if you are using Word or how the external tables are generated so this may not apply.

One approach could be to use links in Word. If each of the SAS tables you need are exported to a separate file whose name does not change then a Word document could be made with instructions to LINK each one. If the external RTF tables have a similar behavior then linking to those as well as the SAS output may accomplish the task.

Since the locations of the source documents and file names will in effect be hard coded in the links my approach with this method was to export / create all of the supporting documents to someplace that made sense. Then when all of the data was ready copy it into a specific source document folder that the Word document would look for them. Open the Word document, refresh all of the links, SAVE AS A NEW DOCUMENT then break all of the links and save again.

Somewhat cumbersome but in lieu of manually pasting 40 odd charts and 120 paragraphs of conditional text for 50+ reports it made lots of sense.

Posts: 30

Re: Include external tables in RTF ODS??

Hi Clara

If you are looking to stack RTF files then here are another two papers about this.

It is a lot more simpler than to think.



Ask a Question
Discussion stats
  • 4 replies
  • 5 in conversation