I'm trying to write some tables to a RTF file, and some to an Excel sheet. After setting up the destinations I have code like the following. However, the title "Excel output 1" is appearing in the RTF output. How do I suppress this?
ods excel select none; title "RTF output 1"; proc etc; run; ods rtf select none; ods excel select all; title "Excel output 1"; proc etc; run;
Hi,
use ods rtf close or ods excel close to stop the destination export.
use TITLE without arguments to cancel all existing titles when not needed any more.
- Cheers -
Hi:
Your understanding is correct. ODS RTF and ODS EXCEL do not allow "appending" after the original file is closed the first time. ODS only will write over the original file name if you try to append -- the only destination that allows appending is ODS HTML. I would either use a Macro program to control what is getting written to each destination like this or I would write all the output to an ODS DOCUMENT store and then replay the objects as I chose to the different destinations. Here's a paper https://support.sas.com/resources/papers/sgf09/318-2009.pdf that describes the ODS DOCUMENT approach. Look on page 17 for a more advanced use of the REPLAY statement to replay objects to differing destinations.
Here's an example of one possible macro program approach:
Since I used STARTPAGE=NO the second title for ODS RTF would not go on the same page with the first TITLE. That's why I used ODS TEXT= to place some text before the 2nd table.
Cynthia
Thanks for this. But it seems very messy for what is a simple requirement. I'll experiment with suppressing all titles and just using ODS Text to output my titles (and format them manually in Word).
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.