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
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.
Thanks.
Does the noprint option prevent ods output statements from generating datasets though?
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.
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.
Thank you.
I will look into this ods document function.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.