ODS Document allows the output from procedures to be stored and then later replayed using PROC DOCUMENT. The syntax to start storing output is: ODS Document NAME=name (WRITE);
The familiar ODS Document CLOSE will stop storing the output. Entries in the document are uniquely identified with sequence numbers.
The entries in a document can be shown using the following code: proc document name=name; list/levels=all; run;
The output for two PROC PRINT outputs, a PROC GPLOT and a PROC FREQ would be:
Obs Path Type
------------------------------------------------
1 \Print#1 Dir
2 \Print#1\Print#1 Report
3 \Print#2 Dir
4 \Print#2\Print#1 Report
3 \Gplot#1 Dir
4 \Gplot#1\Gplot#1 Graph
5 \Freq#1 Dir
6 \Freq#1\x_by_y#1 Dir
7 \Freq#1\x_by_y#1\CrossTabFreqs#1 Crosstab
The path will be used in the PROC DOCUMENT code to replay the correct output. To replay the Graph the following code would be used: proc document name=name; dir \Gplot#1; run; replay Gplot#1; quit;
ods rtf file="C:\NESUG2004\profile.rtf";
**************************************************
* This Uses ODS Layout with relative referencing *
**************************************************;
ods layout start rows=4 columns=2;
ods region row=1 column=1;
proc document name=profile; dir \Print#1; run; replay Print#1; quit;
ods region row=1 column=2;
proc document name=profile; dir \Print#2; run; replay Print#1; quit;
ods layout end;
ods rtf close;
SAS® Reference PROC DOCUMENT, Cynthia Zender
SAS® Reference PROC DOCUMENT Syntax
1. Automating the Production of Patient Profiles Using PROC DOCUMENT and ODS Layout, Doug Lassman