ODS TRACE Statement

Writes to the SAS log a record of each output object that is created, or suppresses the writing of this record.
Valid in: Anywhere
Category: ODS: Output Control
Default: OFF
Creating a Data Set with and without the MATCH_ALL Option

Syntax

ODS TRACE ON </option(s)> ;
ODS TRACE OFF;

Required Arguments

OFF
turns off the writing of the trace record.
Alias:NO
ON
turns on the writing of the trace record.
Aliases:OUTPUT

YES

Optional Arguments

EXCLUDED
includes, in the trace record, information for excluded output objects.
LABEL
includes the label path for the output object in the record. You can use a label path anywhere that you can use a path.
Tip:This option is helpful for users who are running a localized version of SAS, because the labels are translated from English to the local language. The names and paths of output objects are not translated because they are part of the syntax of the Output Delivery System.
LISTING
writes the trace record to the LISTING destination, so that each part of the trace record immediately precedes the output object that it describes.

Details

Contents of the Trace Record

ODS produces an output object by combining data from the data component with a table definition. The trace record provides information about the data component, the table definition, and the output object. By default, the record that the ODS TRACE statement produces contains these items:
Name
is the name of the output object. You can use the name to reference this output object and others with the same name. For details about how to reference an output object, see How ODS Determines the Destinations for an Output Object. For example, you could use this name in an ODS OUTPUT statement to make a data set from the output object. You could also use this name in an ODS SELECT or an ODS EXCLUDE statement.
Tip
The name is the rightmost part of the path that appears in the trace record.
Label
briefly describes the contents of the output object. This label also identifies the output object in the Results window.
Data name
is the name of the data component that was used to create this output object. The data name appears only if it differs from the name of the output object.
Data label
describes the contents of the data.
Template
is the name of the table definition that ODS uses to format the output object. You can modify this definition with PROC TEMPLATE. See the EDIT Statement for more information.
Path
is the path of the output object. You can use the path to reference this output object. For example, you could use the path in the ODS OUTPUT statement to make a data set from the output. You could also use the path in an ODS SELECT or an ODS EXCLUDE statement.
The LABEL option modifies the trace record by including the label path for the object in the record. See the discussion of the option LABEL.

Specifying an Output Object

After you have determined which output objects your SAS program produces, you can specify the output objects in statements such as ODS EXCLUDE, ODS SELECT, and so on. You can specify an output object by using one of the following:
  • a full path. For example, the following is the full path of the output object:
    Univariate.City_Pop_90.TestsForLocation
  • a partial path. A partial path consists of any part of the full path that begins immediately after a period (.) and continues to the end of the full path. For example, suppose the full path is the following:
    Univariate.City_Pop_90.TestsForLocation
    Then the partial paths are as follows:
    City_Pop_90.TestsForLocation
    TestsForLocation
  • a label that is enclosed by quotation marks. For example:
    "The UNIVARIATE Procedure"
  • a label path. For example, the following is the label path for the output object:
    "The UNIVARIATE Procedure"."CityPop_90"."Tests For Location"
    Note: The trace record shows the label path only if you specify the LABEL option in the ODS TRACE statement.
  • a partial label path. A partial label path consists of any part of the label that begins immediately after a period (.) and continues to the end of the label. For example, suppose the label path is the following:
    "The UNIVARIATE Procedure"."CityPop_90"."Tests For Location"
       
    Then the partial label paths are as follows:
    "CityPop_90"."Tests For Location"
    "Tests For Location"
  • a mixture of labels and paths.
  • any of the partial path specifications, followed by a pound sign (#) and a number. For example, TestsForLocation#3 refers to the third output object that is named TestsForLocation.

Example: Determining Which Output Objects a Procedure Creates

Features:
ODS TRACE statement::
LABEL
OFF
ON
Other features:

PROC UNIVARIATE

Data set: StatePop

Details

This example shows how to determine the names and labels of the output objects that a procedure creates. You can use this information to select and exclude output objects.

Program

ods trace on / label;
proc univariate data=statepop mu0=3.5;
   var citypop_90 citypop_80;
run;
ods trace off;

Program Description

Specify that SAS write the trace record to the SAS log and include label paths. This ODS TRACE statement writes the trace record to the SAS log. The LABEL option includes label paths in the trace record.
ods trace on / label;
Create descriptive statistics for two variables. PROC UNIVARIATE computes descriptive statistics for two variables, CityPop_80 and CityPop_90. As PROC UNIVARIATE sends each output object to the Output Delivery System, ODS writes the pertinent information for that output object to the trace record.
proc univariate data=statepop mu0=3.5;
   var citypop_90 citypop_80;
run;
Specify that SAS stop writing the trace record. The ODS TRACE OFF statement stops the writing of the trace record to the SAS log.
ods trace off;

SAS Log

This partial SAS log shows the trace record that the ODS TRACE statement creates. For each analysis variable, PROC UNIVARIATE creates five output objects : Moments, BasicMeasures, TestsForLocation, Quantiles, and ExtremeObs. Notice that an output object has the same name and label, regardless of which variable is analyzed. Therefore, you can select all the moments tables that PROC UNIVARIATE produces by using the name or label in an ODS SELECT statement. The path and label path are unique for each output object because they include the name of the variable that is analyzed. You can, therefore, select an individual moments table by using the path or the label path in an ODS SELECT statement.
Output Added:
-------------
Name:       Moments
Label:      Moments
Template:   base.univariate.Moments
Path:       Univariate.CityPop_90.Moments
Label Path: "The Univariate Procedure"."CityPop_90"."Moments"
-------------
Output Added:
-------------
Name:       BasicMeasures
Label:      Basic Measures of Location and Variability
Template:   base.univariate.Measures
Path:       Univariate.CityPop_90.BasicMeasures
Label Path: "The Univariate Procedure"."CityPop_90"."Basic Measures of Location and Variability"
-------------
Output Added:
-------------
Name:       TestsForLocation
Label:      Tests For Location
Template:   base.univariate.Location
Path:       Univariate.CityPop_90.TestsForLocation
Label Path: "The Univariate Procedure"."CityPop_90"."Tests For Location"
-------------
Output Added:
-------------
Name:       Quantiles
Label:      Quantiles
Template:   base.univariate.Quantiles
Path:       Univariate.CityPop_90.Quantiles
Label Path: "The Univariate Procedure"."CityPop_90"."Quantiles"
-------------
Output Added:
-------------
Name:       ExtremeObs
Label:      Extreme Observations
Template:   base.univariate.ExtObs
Path:       Univariate.CityPop_90.ExtremeObs
Label Path: "The Univariate Procedure"."CityPop_90"."Extreme Observations"
-------------
Output Added:
-------------
Name:       Moments
Label:      Moments
Template:   base.univariate.Moments
Path:       Univariate.CityPop_80.Moments
Label Path: "The Univariate Procedure"."CityPop_80"."Moments"
-------------
Output Added:
-------------
Name:       BasicMeasures
Label:      Basic Measures of Location and Variability
Template:   base.univariate.Measures
Path:       Univariate.CityPop_80.BasicMeasures
Label Path: "The Univariate Procedure"."CityPop_80"."Basic Measures of Location and Variability"
-------------
Output Added:
-------------
Name:       TestsForLocation
Label:      Tests For Location
Template:   base.univariate.Location
Path:       Univariate.CityPop_80.TestsForLocation
Label Path: "The Univariate Procedure"."CityPop_80"."Tests For Location"
-------------
Output Added:
-------------
Name:       Quantiles
Label:      Quantiles
Template:   base.univariate.Quantiles
Path:       Univariate.CityPop_80.Quantiles
Label Path: "The Univariate Procedure"."CityPop_80"."Quantiles"
-------------
Output Added:
-------------
Name:       ExtremeObs
Label:      Extreme Observations
Template:   base.univariate.ExtObs
Path:       Univariate.CityPop_80.ExtremeObs
Label Path: "The Univariate Procedure"."CityPop_80"."Extreme Observations"
-------------