The Output Delivery System (ODS)

Introduction To ODS

Output Objects

The ODS, like most things SAS, is extremely powerful and includes the ability to restrict output, create output to files of numerous types (including pdf, rtf, and Powerpoint slides) and the ability to create SAS data sets containing the results. The basic use of ODS can be learned in a few minutes.

When a SAS procedure runs, it produces (often lots of) results in the form of numbers and text. These results are organized into output objects.


For example consider the following program:
proc univariate data=fram.frex4;
var chol;
run;
Part of the output for this program is re-produced in the following figure:
Output from program can't be displayed
Note that the output is in discrete sections, the first one is labelled "Moments", the second one is labelled "Basic Statistical Measures." Each of these sections is an output object.


Identifying Output Objects

To deal with these output objects, we need to be able to refer to them. Each object has a name (the naming conventions are the same as for SAS data sets). To identify the names one can find them in the details tab of SAS help for the procedure. One can also, however, use the ODS TRACE (on/off) statement. The video that provides a short example of its use.



Note that the number of output objects created in a particular proc step depends on what additional statements or options are requested. For example, the following program requests a histogram of the cholesterol values on the dataset. So there will be an additional object (the histogram) created.
proc univariate data=fram.frex4;
var chol;
histogram chol;
run;


Restricting Which Output Objects are Created

Once we know the names of the output objects we can restrict the objects use either of the following statements:
ods select
or
ods exclude
The video that provides a short example of their use.


Creating SAS data sets from Output Objects

A very handy feature of ODS is the ability to save the results in the output objects as SAS data sets. This is often a nice feature when doing bootstrap or simulation analyses. This feature is accessed with the ODS output statement:
ODS output Objectname=Datasetname
The video that provides a short example of its use.


The ODS system is SAS also allows one to control what is done with output. One of the handy things that can be done is to create files that can be read in Microsoft Office and files that can be read as webpages. The capability of these commands is much more extensive than I present here -- refer to SAS help for additional information.


Creating excel files

Excel is particulary handy for creating tables and formatting tables so it is sometimes useful to have SAS output in an excel table. This is accomplished with the ODS excel statement.


Creating pdf files

Portable document format (PDF) is widely used so sometimes one might like their SAS output in pdf format. This is accomplished with the ODS pdf statement.


Creating Powerpoint Slides

To create powerpoint slides, use the ODS powerpoint statement.


Creating html files

Occasionally one might want to include SAS output on a web page. Webpages are usually constructed using the hypertext markup language (HTML) and browsers interpret this language in order to display pages correctly. Creating an html file in SAS is easily accomplished with the ods html or ods html5 statements.
Except for the name (and file created) in SAS they have the exact same format. HTML5 is the latest version of the language so I demonstrate the creation of a webpage using html5.


Summary and further study.

This has been a very short introduction to ODS. ODS capabilities are extensive and include the ability to create additional file types and the capability to specify extensive customization of formatting. See SAS help for Base SAS, Output Delivery System if you wish a more comprehensive presentation.