Using the Output Delivery System

Output Objects and ODS Destinations

All SAS procedures produce output objects that ODS delivers to various ODS destinations, according to the default specifications for the procedure or according to your own specifications. Typically, you see the output objects displayed as tables, data sets, or graphs. Underlying all output (for example, a table of parameter estimates) are two component parts:

  • the data component, which consists of the results computed by a SAS procedure

  • the template, which contains the instructions for formatting and displaying the results

Each output object has an associated template, provided by the SAS System, that defines its presentation format. You can use the TEMPLATE procedure to view or alter these templates or to create new templates by changing the headers, formats, column order, and so on. For more information, see the chapter titled "The Template Procedure" in the SAS Output Delivery System: User's Guide.

You define the form that the output should take by specifying an ODS destination. Some supported destinations are as follows:

  • LISTING, the standard SAS monospace listing

  • HTML, for viewing in a browser

  • RTF, for inclusion in Microsoft Word

  • PDF, PostScript, and PCL, for high-fidelity printers

  • OUTPUT, for saving results to SAS data sets

  • DOCUMENT, for saving, modifying, and replaying your output

You can open multiple ODS destinations at the same time so that a single procedure step can produce output for multiple destinations. If you do not supply any ODS statements, ODS delivers all output to the default destination (which is usually LISTING or HTML). See the section Output Defaults for more information about default destinations. You can specify an output style for each ODS destination. The style controls the foreground, background, colors, lines, fonts, and so on.

The following statements provide an example of temporarily closing all open destinations for PROC REG and then opening the PDF and HTML destinations for PROC PRINT. PROC REG with the ODS OUTPUT statement makes an output data set, Parms, from the parameter estimates table. Closing unneeded open destinations is not required, but it is done in many examples in this chapter for efficiency. Closing the superfluous destinations suppresses the generation of output that is not needed or used. This is particularly beneficial with graphics. This example uses the Sashelp.Class data set, one of the sample data sets in the Sashelp library that are automatically available for your use. The following statements produce FigureĀ 20.4:

title 'Getting Started with ODS';

ods _all_ close;

proc reg data=sashelp.class;
   model height=weight;
   ods output ParameterEstimates=parms;
run; quit;

ods pdf;
ods html;

proc print noobs data=parms;

The ODS OUTPUT statement contains an object name, an equal sign, and the name of the output SAS data set to create. You can use the ODS TRACE statement to find the object names. The ODS TRACE statement is described in the section Paths and Selection. Also see Example 20.4 for more information.

Figure 20.4: PROC REG Parameter Estimates Table

Getting Started with ODS

Model Dependent Variable DF Estimate StdErr tValue Probt
MODEL1 Height Intercept 1 42.57014 2.67989 15.89 <.0001
MODEL1 Height Weight 1 0.19761 0.02616 7.55 <.0001

You could accomplish the same thing using ODS SELECT statements as follows:

ods select none;

proc reg data=sashelp.class;
   model height=weight;
   ods output ParameterEstimates=parms;
run; quit;

ods select all;

proc print noobs data=parms;

You can specify ODS EXCLUDE ALL instead of ODS SELECT NONE and ODS EXCLUDE NONE instead of ODS SELECT ALL. These statements remain in effect until a new ODS SELECT or ODS EXCLUDE statement changes the selection list.