24.1 - How ODS Works

You might be getting the impression that by learning about the Output Delivery System (ODS) in this lesson 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 generate 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:

AB
Frequency Percent12Total
16040100
30.0020.0050.00
24060100
20.0030.0050.00
Total100100200
50.0050.00100.00

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

AB
Frequency Percent12Total
1   
   
2   
   
Total   
   

and the data component:

ABCOUNTPERCENT
 16030
124020
214020
226030

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. 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, among others, you can send your output to different destinations to produce different output formats.

destinationformat produced
HTMLoutput that is formatted in HyperText Markup Language (HTML), and therefore viewable by web browsers
OutputSAS data sets
Printer Familyoutput that is formatted for a high-resolution printer, such as PostScript (PS), Portable Document Format (PDF), and Printer Control Language (PCL) files
RTFrich 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.