Chapter Contents

Previous

Next
The ODS Statements

ODS OUTPUT Statement


Creates a SAS data set from an output object and manages the selection and exclusion lists for the Output destination.

Featured in: Creating Output Data Sets


ODS OUTPUT action
ODS OUTPUT data-set-definition(s);


Arguments

action
takes some action regarding selection and exclusion lists, or closes the Output destination. action can be one of the following:

CLEAR
sets the list for the Output destination to EXCLUDE ALL.

CLOSE
closes the Output destination. When an ODS destination is closed, ODS does not send output to that destination. Closing an unneeded destination frees some system resources.

SHOW
writes to the SAS log the current selection or exclusion list for the Output destination. If the list is the default list (EXCLUDE ALL), SHOW also writes the the current overall selection or exclusion list.
Restriction: The Output destination must be open for this action to take effect.

data-set-definition
provides instructions for turning an output object into a SAS data set. ODS maintains a list of these definitions. (This list is the selection list for the Output destination.) For information on how ODS manages this list, see Modifying Selection and Exclusion Lists. Each data-set-definition has the following form:
output-object-specification=SAS-data-set
where

output-object-specification
has the following form:
output-object<(MATCH_ALL<=macro-var-name> PERSIST=PROC | RUN)>
where

output-object
identifies one or more output objects to turn into a SAS data set.

To specify an output object, you need to know what output objects your SAS program produces. The ODS TRACE statement writes to the SAS log a trace record that includes the path, the label, and other information about each output object that is produced. (See ODS TRACE Statement.) You can specify an output object as

By default, the ODS OUTPUT statement tries to put all output objects that have the same output-path into one SAS data set. Sometimes this process is problematic because the structure of the output object changes after the data set has been opened. For instance, some data-dependent output objects may have a different number of columns than other output objects identified by the same output-path. In this case, the columns that are in the first output object will determine the variables that are in the data set. Two difficulties may arise:

If the ODS OUTPUT statement has a problem putting all output objects into one data set, it returns a warning.
Tip: To create multiple data sets from the same output object, list the output object as many times as you wish. Each time that you list the output object, specify a different data set.
Featured in: Creating Output Data Sets

MATCH_ALL<=macro-var-name>
creates a new data set for each output object. For an explanation of how ODS names these data sets, see the discussion of SAS-data-set.

If you specify macro-var-name, the system stores a list of all the data sets that it creates in the macro variable that you specify. Thus, if you want to concatenate all the data sets after the PROC step, you can use the macro variable to specify all the data sets in a DATA step.
Featured in: Creating Output Data Sets

PERSIST=PROC | RUN
determines when ODS closes any data sets that it is creating and when it removes output objects from the selection list for the Output destination.

PROC
maintains the list of definitions across step boundaries or until you explicitly modify it. To modify the list, use ODS OUTPUT with one or more data-set-specifications. To set the list for the Output destination to EXCLUDE ALL, use the following statement:

ods output clear;
Restriction: Only effective when MATCH_ALL is in effect (and you are, therefore, creating a data set for each output object).
Featured in: Creating Data Sets from Similar Output Objects from Different Procedures

RUN
maintains the list of definitions and keeps the data sets that it is creating open until a step boundary is reached or until you explicitly modify the list.

See also: How ODS Determines the Destinations for an Output Object

SAS-data-set
names the output data set. You can use a one-level or two-level (with a libref) name.

If you are creating a single data set, the ODS OUTPUT statement simply uses the name that you specify. If you are creating multiple data sets with MATCH_ALL, the ODS OUTPUT statement appends digits to the name. For example, if you specify test as SAS-data-set and you create three data sets, ODS name the first data set test. The additional data sets are named test1 and test2.

Note:    If you end the file name with a digit, ODS begins incrementing with that digit. For example, if you specify may5 as SAS-data-set and you create three data sets, ODS names the first data set may5. The additional data sets are named may6 and may7.   [cautend]
Tip: You can specify data set options in parentheses immediately after SAS-data-set.
Featured in: Creating Output Data Sets

SHOW
functions just like the ODS SHOW statement except that it writes only the selection or exclusion list for the Output destination.


Chapter Contents

Previous

Next

Top of Page

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.