10-26-2011 06:33 AM
10-26-2011 03:07 PM
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.
10-26-2011 03:20 PM
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: http://www.lexjansen.com/pharmasug/2010/po/po05.pdf
10-27-2011 01:21 PM
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.
05-21-2012 10:26 PM
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.