BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Amine_Khemiri
Obsidian | Level 7

I would like to combine 100 rtf files in one rtf file using SAS studio.

Thanks for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
Amine_Khemiri
Obsidian | Level 7

Dear All,

 

Please note that I found a macros that is combining multiple rtf file in one single rtf file and it works very well.

 

https://www.bioinfo-scrounger.com/archives/combine_rtf/?fbclid=IwAR0i-lugw5FT-w_nOcTbEfJ5lh6qpBLf0HW...

 

Thanks.

 

Kind regards,

Amine

 

 

View solution in original post

6 REPLIES 6
A_Kh
Barite | Level 11

Are you creating those 100 rtf files in sas? If yes, then what is your code to create those files? 

Amine_Khemiri
Obsidian | Level 7
Yes, I have different SAS codes that create 100 rtf files. Now, I want a code to combine all 100 files into 1 single rtf file.
ballardw
Super User

Not really a SAS job to combine already existing files.

If you created them from SAS then the proper way is to create ONE file instead of 100s. Easy to do in theory: wrap all of the output creating steps that write to the RTF in single ODS RTF call:

 

Dummy code:

Ods rtf file="<path>\bigfile.rtf" <other rtf options>;

<first proc step that creates output>
<second proc step that creates output>
<repeat until last proc step that creates output>

ods rtf close;

Or create the output and use Proc document to gather all the output together for the rtf output.

 

If you have "different sas codes" you could use %include to call separate SAS files but you would want to remove the specific ods rtf output/close in any of them to use the above approach.

A_Kh
Barite | Level 11

In this case, you should put all your codes inside a single ODS RTF sandwich as suggested in previous comments.  See additional comments here

Amine_Khemiri
Obsidian | Level 7

Dear All,

 

Please note that I found a macros that is combining multiple rtf file in one single rtf file and it works very well.

 

https://www.bioinfo-scrounger.com/archives/combine_rtf/?fbclid=IwAR0i-lugw5FT-w_nOcTbEfJ5lh6qpBLf0HW...

 

Thanks.

 

Kind regards,

Amine

 

 

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
  • 6 replies
  • 3008 views
  • 2 likes
  • 4 in conversation