9.1 Output Delivery System (ODS) Architecture Basics

Key Takeaways

  • ODS decouples procedure output generation into two separate entities: a Data Component (unformatted raw results) and a Table Definition / Template (formatting rules).
  • The combination of a Data Component and a Table Definition creates an Output Object, which ODS then formats for one or more output destinations simultaneously.
  • The ODS TRACE ON statement writes detailed metadata about output objects (Name, Label, Template, and Path) directly to the SAS log.
  • ODS SELECT and ODS EXCLUDE statements filter which output objects are sent to open destinations, accepting single names, lists, or wildcard specifications.
  • The ODS OUTPUT statement captures any ODS output object and saves it as a standard, reusable SAS data set for further data step processing or reporting.
Last updated: August 2026

9.1 Output Delivery System (ODS) Architecture Basics

Prior to SAS Version 7, SAS procedure output was tightly coupled to rigid, monospaced text destinations—primarily the traditional SAS procedure output file known as the LISTING destination. If a programmer needed to extract a single calculated statistic (such as a p-value, a mean, or a parameter estimate) from a procedure, they had to resort to parsing text files with complex column offset logic or relying on limited OUT= data set options provided by specific procedures.

The introduction of the Output Delivery System (ODS) completely revolutionized how SAS processes and formats output. ODS decouples data generation from report presentation. Rather than hardcoding formatted text directly into an output file, SAS procedures now produce structured, unformatted data components that ODS transforms into handsome reports across dozens of modern file formats.


The ODS Component Architecture

To master ODS for the SAS Base Programming exam, you must understand the two core components that unite to produce output:

  1. Data Component: The raw, unformatted data values produced by a SAS DATA step or PROC step during execution. The data component contains pure numbers, characters, and structural metrics without font sizes, colors, or page layout rules.
  2. Table Definition (Template): A blueprint or set of formatting instructions created using PROC TEMPLATE. It defines column headers, data alignment, numeric formats, font styles, colors, and border styles.

When a SAS procedure runs under ODS, it combines the Data Component and the Table Definition to form an Output Object.

Data Component+Table Definition=Output Object\text{Data Component} + \text{Table Definition} = \text{Output Object}

+------------------------+      +-------------------------+
|     Data Component     |  +   |    Table Definition     |
| (Raw Unformatted Data) |      | (PROC TEMPLATE Blueprint)|
+------------------------+      +-------------------------+
                    \                /
                     \              /
                      v            v
               +--------------------------+
               |      Output Object       |
               | (Named SAS Report Element)|
               +--------------------------+
                            |
           +----------------+----------------+
           |                |                |
           v                v                v
     +-----------+    +-----------+    +-----------+
     |   HTML    |    |    PDF    |    |   EXCEL   |
     +-----------+    +-----------+    +-----------+

Once an Output Object is created in memory, ODS can route it to one or more destinations simultaneously—such as HTML, PDF, RTF, EXCEL, or a SAS Data Set—without re-running the underlying procedure.


Discovering Output Objects with ODS TRACE

Every SAS procedure generates one or more distinct output objects. For example, PROC MEANS produces output objects for summary statistics, while PROC UNIVARIATE produces multiple objects including Moments, BasicMeasures, TestsForLocation, Quantiles, and ExtremeObs.

To determine the exact names of output objects generated by a procedure, use the ODS TRACE statement.

Syntax for ODS TRACE

ODS TRACE ON </ LISTING>;
/* SAS Procedure Code Here */
ODS TRACE OFF;

When ODS TRACE ON; is executed, SAS writes a trace record to the SAS Log for every output object created by subsequent procedure steps.

Example: Tracing PROC UNIVARIATE

ods trace on;

proc univariate data=sashelp.class;
   var Height;
run;

ods trace off;

SAS Log Trace Output Sample

Output Added:
-------------
Name:       Moments
Label:      Moments
Template:   base.univariate.Moments
Path:       Univariate.Height.Moments
-------------
Output Added:
-------------
Name:       BasicMeasures
Label:      Basic Measures
Template:   base.univariate.Measures
Path:       Univariate.Height.BasicMeasures
-------------
Output Added:
-------------
Name:       Quantiles
Label:      Quantiles
Template:   base.univariate.Quantiles
Path:       Univariate.Height.Quantiles
-------------

Key Trace Fields to Know for the Exam

Trace FieldDescriptionExam Relevance
NameThe unique identifier of the output object (e.g., Quantiles, ExtremeObs).Used in ODS SELECT, ODS EXCLUDE, and ODS OUTPUT statements.
LabelA descriptive human-readable title for the output object (e.g., Basic Measures).Can also be referenced in selection/exclusion lists.
TemplateThe name of the PROC TEMPLATE definition used to format the object.Identifies the default visual blueprint.
PathThe full hierarchical path of the object (e.g., Univariate.Height.Moments).Useful when multiple variables generate identical object names.

[!TIP] ODS TRACE ON; remains active across subsequent step boundaries until explicitly turned off with ODS TRACE OFF;. Always turn off tracing when debugging is complete to avoid cluttering the SAS Log.


Filtering Output Objects with ODS SELECT and ODS EXCLUDE

By default, ODS sends all output objects generated by a procedure to all currently open destinations. However, you can precisely control which objects appear in your reports using the ODS SELECT and ODS EXCLUDE statements.

1. The ODS SELECT Statement

The ODS SELECT statement specifies that only the listed output objects should be delivered to open ODS destinations. All unlisted objects are discarded.

/* Deliver ONLY the Moments and Quantiles objects */
ods select Moments Quantiles;

proc univariate data=sashelp.class;
   var Weight;
run;

2. The ODS EXCLUDE Statement

The ODS EXCLUDE statement specifies that the listed output objects should be suppressed. All unlisted objects are delivered to open destinations.

/* Suppress ExtremeObs and TestsForLocation */
ods exclude ExtremeObs TestsForLocation;

proc univariate data=sashelp.class;
   var Weight;
run;

3. Resetting Selection and Exclusion Filters

ODS selection and exclusion lists persist across procedure steps. To restore default behavior where all output objects are sent to open destinations, use ODS SELECT ALL; or ODS EXCLUDE NONE;.

/* Reset ODS filters to default */
ods select all;
/* OR */
ods exclude none;

ODS Filtering Rules Summary Table

Statement SyntaxEffect on Output ObjectsPersistence
ODS SELECT object-list;Keeps only specified objects; suppresses all others.Persists until changed or reset.
ODS EXCLUDE object-list;Suppresses specified objects; keeps all others.Persists until changed or reset.
ODS SELECT ALL;Resets selection filter to deliver all generated objects.Cancels prior ODS SELECT / EXCLUDE.
ODS EXCLUDE NONE;Resets exclusion filter to deliver all generated objects.Cancels prior ODS SELECT / EXCLUDE.

Capturing Output into Data Sets with ODS OUTPUT

One of the most powerful features of ODS architecture is the ODS OUTPUT statement. It allows you to intercept any ODS output object and convert it into a standard SAS data set.

Unlike older SAS procedure OUT= data set options (which were limited to specific procedures and fixed structures), ODS OUTPUT works with any ODS output object from any SAS procedure.

Syntax for ODS OUTPUT

ODS OUTPUT output-object-name = new-sas-data-set <(data-set-options)>;

Practical Example: Converting PROC MEANS Output into a SAS Data Set

Suppose you want to extract summary statistics from PROC MEANS and store them in a SAS data set named ClassSummary for subsequent processing.

/* Step 1: Trace or identify object name (PROC MEANS default summary is Summary) */
ods output Summary = work.ClassSummary;

proc means data=sashelp.class mean std min max;
   var Age Height Weight;
   class Sex;
run;

/* Step 2: Print the captured SAS Data Set */
proc print data=work.ClassSummary;
   title "Summary Statistics Captured via ODS OUTPUT";
run;

Multiple Object Capture

You can capture multiple objects in a single ODS OUTPUT statement:

ods output Moments = work.HeightMoments
           Quantiles = work.HeightQuantiles;

proc univariate data=sashelp.class;
   var Height;
run;

[!IMPORTANT] The ODS OUTPUT statement is an environment control statement. It must be placed before or within the procedure step that generates the output object. The resulting SAS data set is closed and written when the procedure step terminates.

Test Your Knowledge

Which two components combine in ODS architecture to form a SAS Output Object?

A
B
C
D
Test Your Knowledge

A programmer runs ODS TRACE ON; before running PROC UNIVARIATE. Where does SAS write the trace information containing output object names and templates?

A
B
C
D
Test Your Knowledge

Consider the following SAS program:

ods select ExtremeObs Quantiles;
proc univariate data=sashelp.class;
   var Weight;
run;
What is the effect of the ODS SELECT statement in this program?

A
B
C
D
Test Your Knowledge

Which SAS statement creates a standard SAS data set directly from any named ODS output object?

A
B
C
D