BookmarkSubscribeRSS Feed
DGrint
Obsidian | Level 7

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

5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

DGrint
Obsidian | Level 7

Thanks.

 

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

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Tim_SAS
Barite | Level 11

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. 

DGrint
Obsidian | Level 7

Thank you.

 

I will look into this ods document function.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1283 views
  • 0 likes
  • 3 in conversation