24.1 - How ODS Works

You might be getting the impression that by learning about the Output Delivery System (ODS) in this lesson that it will be the first time we use it. In reality, SAS has been using it behind the scenes all along to create the listing output that the procedures we've used generates by default. All we want to do in this lesson is learn how ODS works and how to change the default settings so that we can get the output that we want rather than the output that SAS wants.

So how does ODS work? Whenever you submit a program that creates output, ODS does the following:

1) ODS creates your output in the form of output objects. Each output object is comprised of two components. The data component contains the results — think numbers — of a procedure or a DATA step. The table definition tells SAS how to render the results — think structure. For example, suppose we executed the FREQ procedure so that it created the following output:

A B
Frequency Percent 1 2 Total
1 60 40 100
30.00 20.00 50.00
2 40 60 100
20.00 30.00 50.00
Total 100 100 200
50.00 50.00 100.00

SAS actually creates this piece of output from its two parts, the table definition:

A B
Frequency Percent 1 2 Total
1      
     
2      
     
Total      
     

and the data component:

A B COUNT PERCENT
  1 60 30
1 2 40 20
2 1 40 20
2 2 60 30

2) Once SAS creates all of the output objects from an executed program, it then just needs to figure out where to send the objects. It's actually pretty easy... SAS sends the output to whatever ODS destination(s) you tell SAS to send it. And when doing so, SAS sends the output in the format specified by the destination. This is where ODS is really powerful and therefore really neat! Besides the listing output generated by SAS procedures by default, and among others, you can send your output to...

this destination ... to produce...
HTML output that is formatted in HyperText Markup Language (HTML), and therefore viewable by web browsers
Output SAS data sets
Printer Family output that is formatted for a high-resolution printer, such as Post Script (PS), Portable Document Format (PDF), and Printer Control Language (PCL) files
RTF rich text format output for use with Microsoft Word

In the next section, we'll learn how to tell SAS where to send the output it generates by "opening" and "closing" these various ODS destinations.