BookmarkSubscribeRSS Feed
abhinayingole
Obsidian | Level 7

how to include multiple rtf files in one rtf using sas ?

4 REPLIES 4
ballardw
Super User

Input (?????) or output?

Once SAS has created an output RTF (or pretty much any other ODS destination) it is up to other tools to combine them, if that is your question.

 

In SAS you have two ways to create such combined files: Place all of the output generated inside one ODS destination statement:

Dummy example:

ods rtf file="<path>somefile.rtf" <other ods options>;

Proc whatever;
run;
Proc otherproc;
run;

Proc yetanother;
run;

ods rtf close;

Another option is create all of the output in one session and then use Proc Document to select and combine the output objects and send to a single ODS destination.

abhinayingole
Obsidian | Level 7

i have 4 rtf file (already generated), i wanted to combine these 4 rtf in one rtf or pdf.

 

do you have any sample code for this ?

Reeza
Super User
It can be done using SAS but there are better tools for this - Adobe Acrobat professional would be my suggestion.
Especially if this is something that needs to be done once.

https://www.lexjansen.com/pharmasug/2010/PO/PO05.pdf

https://www.lexjansen.com/nesug/nesug11/po/po10.pdf
Cynthia_sas
Diamond | Level 26
Hi:
As @Reeza has explained, it would be much easier to combine the RTF files using Word or an Adobe product. The reason is that an RTF file, by Microsoft specification, has opening and closing control strings the denote the beginning and end of an RTF file. To combine the files using SAS, you'd have to write a program to strip out these open/close control strings, carefully -- strip the close out of the first file, strip the open and close out of the 2 middle files and then strip the open but leave the close on the last file. Doing this in Word or Adobe would be easier than writing or debugging the SAS program to do it. And unfortunately, if you're not careful, it is possible to corrupt an RTF file so it is not "openable" if you take out the wrong control strings. Just some background on why you'd use a different tool.
Cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1388 views
  • 0 likes
  • 4 in conversation