The SAS Output Delivery System and reporting techniques

Combining ODS output with RTF sandwich and %include

Reply
New Contributor
Posts: 4

Combining ODS output with RTF sandwich and %include

Hello,

 

I want to be able to produce a long document for review. I currently have a number of programs that each create a single table or figure which I want to combine into a single long document.

 

I want to use an RTF sandwich with the %include function calling each individual program to insert each table. So I'm thinking of having one program called combine.sas which does the following:

 

ods rtf file="long_file.rtf";

 

%include "table1.sas";

%include "table2.sas";

...

 

ods rtf close;

 

The problem is each of the table1, table2, etc, programs are quite long with lots of procs and datasteps. Is there an easy way I can restrict these programs so that they only send the final proc report to the RTF file in the combine.sas program?

 

For instance in table1.sas I use proc genmod with an ods output statement to save parameter estimates, then adapt these estimates in a data step to make them ready for outputing in the final proc report. Can I stop the proc genmod output from appearing in the final long_file.rft?

 

Many thanks,

 

Daniel

Esteemed Advisor
Esteemed Advisor
Posts: 7,253

Re: Combining ODS output with RTF sandwich and %include

As far as I can recall, ODS desinations remain open until closed and capture all output.  Therefore you would need to modify the individual ouput procedures, i.e. put noprint option into those procedures which generate output as default - you should really be deciding this when coding your procedures anyway, its rarely a good idea to leave uneccesary output being sent anyways.  

 

Alternatively, output all your required outputs to RTF files and combine them into one at the end.

New Contributor
Posts: 4

Re: Combining ODS output with RTF sandwich and %include

Thanks.

 

Does the noprint option prevent ods output statements from generating datasets though?

Esteemed Advisor
Esteemed Advisor
Posts: 7,253

Re: Combining ODS output with RTF sandwich and %include

Thats code dependant, I wouldn't have thought that it would affect most normal operations (e.g. if you had an out=, or used ods output), but some of the fancy stats procedures are really awful to deal with so wouldn't put it past them.

Super Contributor
Posts: 394

Re: Combining ODS output with RTF sandwich and %include

You can use the ODS SELECT and EXCLUDE statements to choose which tables are added to your final document. Notice that you can optionally specify individual destinations in these statements, so that you could (if you wanted to) add a table or graph to an RTF report but exclude it from an HTML web page.

 

If that's not enough control, check out the ODS DOCUMENT destination. You can route all your output into a document, then selectively replay it to an RTF file. 

New Contributor
Posts: 4

Re: Combining ODS output with RTF sandwich and %include

Thank you.

 

I will look into this ods document function.

Ask a Question
Discussion stats
  • 5 replies
  • 290 views
  • 0 likes
  • 3 in conversation