The SAS Output Delivery System and reporting techniques

ODS Document / SAS Enterprise Guide

Frequent Contributor
Posts: 85

ODS Document / SAS Enterprise Guide

[ Edited ]

I have just come across the document procedure and have the following questions:


  1. How to open the document window from SAS EG as per Have It Your Way: Rearrange and Replay Your Output with ODS DOCUMENT

From the same document, it is stated: " if you work on SAS® Enterprise Guide® (without access to the DOCUMENT window) or you want to create an ODS Document store as part of nightly production processing, then the PROC DOCUMENT syntax will allow you to accomplish these creation, management, and replay tasks"


  1. Is the document procedure recommended for what I want 
    • I output all my results to a HTML file; basically a dump of output that I look through
    • Now I want a formatted PDF file of selected output in a PDF report
    • How will it work if I wish to create a list or table with macro variable values (as per code below in current approach)
  2. What would be the advantages/disadvantages compared to my current approach (not yet implemented)

Edit: It seems advantage of the document store is that it would allow me to include tabular output (not just charts).  However, I haven't yet worked out how to include ad-hoc tables created using the report-writing interface (RWI).  I have also included code to create a table using RWI.


Current approach: After a day of trial and error, I had just settled on the following approach before coming across the document procedure, which essentially is to create the pdf report at the end of all processing using ods text with preimage to link to all the charts... 


/*I have a stack of output going to a html output dump*/
%let gpath=C:\Temp;
ods html gpath="&gpath";
goptions hsize=4in vsize=4in;
ods graphics / reset=index imagename='myimage';
proc sgplot data=sashelp.class;
vbar age / name='gtitle';
title 'Age distribution';
footnote 'Taken from SASHELP.Class';
data _null_;
set sashelp.class;
if name = 'Alfred' then call symput('weightAlfred', put(weight, 4.));
if name = 'Alice' then call symput('weightAlice', put(weight, 4.));

%put _user_;

/*The last step in my EG process: create PDF report*/
options nodate nonumber;
ods escapechar='^';

ods pdf file="&gpath\LayoutGriddedCheck.pdf";
title 'My PDF report';
footnote h=8pt f=Arial j=c 'Page ^{thispage} of ^{lastpage}';

ods layout gridded;

ods region;
title 'Class Details';
footnote 'Taken from SASHELP.Class';
proc print data=sashelp.class(obs=10);

ods region style={just=left};
title 'An included image';
ods text ="^S={preimage='&gpath\myimage2.gif'}";

ods region style={just=left};
title 'Macro values';
proc odstext;
list / style={fontsize=12pt};
item "Alice's weight: &weightAlice";
item "Alfred's weight: &weightAlfred";

/*Report writing interface to create ad-hoc table - document store doesn't capture this ...*/
title 'RWI';
data _null_;
declare odsout o();
o.format_cell(text: "Alice's weight");
o.format_cell(text: "&weightAlice");
o.format_cell(text: "Alfred's weight");
o.format_cell(text: "&weightAlfred");


ods layout end;
ods pdf close;


Any help/suggestions will be much appreciated.


Ask a Question
Discussion stats
  • 0 replies
  • 1 in conversation