BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tpham
Quartz | Level 8

I have a number of SAS programs that produce outputs (e.g. table1_1.SAS, Table2_1.SAS etc) using proc report that produce their respective tables (Table 1.1.RTF and Table 2.1.RTF etc.).

 

I am trying to merge all outputs (so multiple files produced) into one RTF file and have Microsoft word create a table of contents based on headers.

 

I've found an old paper on adding MS Word Headers into ODS RTF outputs that is based on SAS 8.2+. I'm sure it would work on the modern SAS 9, but I am wondering if there are more modern approaches. 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
See if ODS WORD can meet your needs though it's pre-production?

I would definitely redesign my process such that I didn't have to combine multiple RTF files though VBS will do it easily.

View solution in original post

6 REPLIES 6
Reeza
Super User
See if ODS WORD can meet your needs though it's pre-production?

I would definitely redesign my process such that I didn't have to combine multiple RTF files though VBS will do it easily.
Tpham
Quartz | Level 8

I'll explore ods word, but however, each code produce its independent table.

 

BUt yeah, the process I am thinking about is via VBA after adding headers via SAS

Reeza
Super User
Why does it matter that each code produces a single table? You can nest them as long as you place the ODS RTF statements in the correct location and can control the page breaks the same way.

ods rtf file = '......' style = mystyles;

%include 'generateReport1.sas';
%include 'generateReport2.sas';
...

ods rtf close;
Tpham
Quartz | Level 8

log and lst files needs to be saved for each respective program. so the include statement doesn't fully work because of that as I recall.

Reeza
Super User
PROC PRINTTO at each program start should cover that but I'll leave it there.
Jianmin
Obsidian | Level 7

Hi @Tpham , 

The paper you cited is a privative way to answer your request, as @Reeza outlined in this response.   You will also have to figure out a way for a cover page or top page to make the TOC visible, something like this:  

Jianmin_0-1636507334057.png

this is for a large file with many sections which needs a TOC for each section title/header.  See this file  This is way beyond what SAS ODS RTF REPORT/DOCUMENT is currently doing. Another example for multiple listings/tables with a TOC.  

Many Thanks

Jianmin Long

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 963 views
  • 0 likes
  • 3 in conversation