The SAS Output Delivery System (ODS) enables you to control the output from SAS programs. SAS procedures (including PROC IML) use ODS to display results. Most results are displayed as ODS tables; ODS graphics are briefly discussed in Section E.5. The statements that are described in this chapter are presented for tables, but also apply to ODS graphical objects.
There are ODS statements that enable you to control the output that is displayed, the destination for the output (such as the LISTING or HTML destinations), and many other aspects of the output. This appendix describes a few elementary ODS statements that are used in this book. For a more complete description, see the SAS Output Delivery System: User's Guide.
Before you can include, exclude, or save tables, you need to know the names of the tables. You can determine the names of ODS tables by using the ODS TRACE statement. The most basic syntax is as follows:
ODS TRACE
< ON | OFF> ;
When you turn on tracing, the SAS System displays the names of subsequent ODS tables that are produced. The names are usually printed to the SAS log. For example, the following statements display the names of tables that are created by the REG procedure:
ods trace on;
proc reg data=sashelp.class;
model Weight = Height;
run;
ods trace off;
The content of the SAS log is shown in Figure E.1. The procedure creates four tables: the NObs table, the ANOVA table, the FitStatistics table, and the ParameterEstimates table.
You can limit the output from a SAS procedure by using the ODS SELECT and ODS EXCLUDE statements. The ODS SELECT statement specifies the tables that you want displayed; the ODS EXCLUDE statement specifies the tables that you want to suppress. The basic syntax is as follows:
ODS SELECT
table-names | ALL | NONE
;
ODS EXCLUDE
table-names | ALL | NONE ;
For example, if you want PROC REG to display only the NObs and ParameterEstimates tables, you can specify either of the following statements:
ods select NObs ParameterEstimates;
ods exclude ANOVA FitStatistics;
You can use the ODS OUTPUT statement to create a SAS data set from an ODS table. For example, use the following statements to create a SAS data set named PE
from the ParameterEstimates table that is produced by PROC REG:
ods output ParameterEstimates=PE;
proc reg data=sashelp.class;
model Weight = Height;
run;
You can then use the data set as input for another procedure such as PROC IML. Of course, you usually need to know the names of the variables in the data set in order to use the data. You can use PROC CONTENTS to display the variable names, or you can use the CONTENTS function in PROC IML, as shown in the following statements:
proc iml;
VarNames = contents("PE");
print VarNames;
Many SAS procedures support ODS statistical graphics. You can use the ODS GRAPHICS statement to initialize the ODS statistical graphics system. The basic syntax is as follows:
ODS GRAPHICS
ON | OFF
;
Section 12.10 contains an example that turns on ODS graphics for a regression analysis.