SAS ODS: Creating Professional Reports and Output
The Output Delivery System (ODS) is SAS's framework for delivering procedure output in a wide variety of formats. Before ODS, SAS output was plain text. ODS transforms the same analytical results into professional reports, interactive HTML documents, Excel workbooks, PDFs, and more — without changing the analytical code itself.
How ODS Works
ODS intercepts the output objects created by SAS procedures and routes them to one or more destinations simultaneously. You activate a destination with ODS destination OPEN and close it with ODS destination CLOSE. Multiple destinations can be open at once, sending output to HTML and PDF simultaneously, for example. The ODS statement affects all subsequent PROC and DATA step output until the destination is closed.
Key destinations: ODS HTML creates web pages. ODS PDF creates PDF documents with page breaks, headers, and footers. ODS RTF creates Word-compatible files. ODS EXCEL creates native .xlsx files. ODS LISTING is the traditional plain-text output window.
Basic ODS Usage
To create a PDF report: ODS PDF FILE='/reports/analysis.pdf' STYLE=Pearl; PROC MEANS DATA=mydata.employees; VAR salary; RUN; PROC FREQ DATA=mydata.employees; TABLES dept; RUN; ODS PDF CLOSE;. The STYLE= option applies a visual theme. SAS includes over 20 built-in styles, and custom styles can be created with PROC TEMPLATE.
ODS SELECT and EXCLUDE
Most procedures generate multiple output objects. ODS SELECT limits which objects are output: ODS SELECT BasicMeasures Quantiles; before PROC UNIVARIATE outputs only those two tables. ODS EXCLUDE suppresses specific objects. This keeps reports focused and reduces file size. Use ODS TRACE to see the names of output objects generated by any procedure.
Customizing Reports with PROC TEMPLATE
PROC TEMPLATE allows creating and modifying table and style templates. Column headers, formats, column widths, colors, and borders are all controllable. The DEFINE TABLE statement modifies how a specific procedure's output table appears. Combined with styles, this gives complete control over report appearance. For one-off formatting needs, the PRINT procedure's STYLE(column)= option provides inline customization without defining a full template.
Browse our full blog archive for more SAS topics, or explore our resources for SAS certification study guides and practice exam materials.