ODS DOCUMENT Statement

Opens, manages, or closes the DOCUMENT destination, which produces a hierarchy of output objects that enables you to produce multiple ODS output formats without rerunning a PROC or DATA step.
Valid in: Anywhere
Category: ODS: Output Control

Syntax

ODS DOCUMENT action;
ODS DOCUMENT

Actions

The following actions are available for the ODS DOCUMENT statement:

CLOSE
closes the destination and any files that are associated with it.
Tip:When an ODS destination is closed, ODS does not send output to that destination. Closing an unneeded destination frees some system resources.
EXCLUDE exclusion(s)| ALL | NONE
excludes one or more output objects from the DOCUMENT destination.
Default:NONE
Restriction:The DOCUMENT destination must be open for this action to take effect.
SELECT selection(s) | ALL | NONE
selects one or more output objects for the DOCUMENT destination.
Default:ALL
Restriction:The DOCUMENT destination must be open for this action to take effect.
SHOW
writes the current selection or exclusion list for the destination to the SAS log.
Restriction:The destination must be open for this action to take effect.
Tip:If the selection or exclusion list is the default list (SELECT ALL), then SHOW also writes the entire selection or exclusion list.

Optional Arguments

CATALOG=permanent-catalog | _NULL_
CAUTION:
If you do not specify a value (other than _NULL_) for this option, then you can replay temporary GRSEGs only during the session in which they are created, not in subsequent sessions.
permanent-catalog
copies any temporary GRSEG to the specified permanent catalog and keeps a reference to the permanent GRSEG in the document. This value persists until the ODS DOCUMENT statement is closed, or until you delete it by specifying CATALOG=_NULL_.
The permanent catalog has the following form:
<libref.> < member-name> ;
_NULL_
deletes the catalog name that was previously specified for the CATALOG= option. Thereafter, temporary GRSEGs are not copied into the permanent catalog, and thus are unavailable in subsequent sessions.
Alias:CAT=
Default:By default, no value is assigned to CATALOG=, which means that temporary GRSEGs are not copied to a permanent catalog.
DIR=(<PATH=path<(access-option)>><LABEL='label'>);
specifies the directory path and/or label for ODS output.
LABEL=label
assigns a label to a path.
Requirement:The label that you assign must be enclosed in quotation marks.
Interaction:If LABEL= is used with the PATH= option, then the label applies to the path. If LABEL= is used without the PATH= option, then the label applies to the entire document.
PATH=path <(access-option)>
is specified as a sequence of entries that are delimited by backslashes.
path
can have the following form:
path<#sequence–number>
path
is the name of the path.
#sequence–number
is a number which, when combined with a pathname, uniquely identifies the entry in the directory that contains it.
Default:The default path is “\” (root).
Tip:You can specify a directory that contains entries that do not exist in the document.
access-option
specifies the access mode for the ODS document.
WRITE
opens a document and provides Write access as well as Read access.
Interaction:If a label has been specified with the LABEL= option, then it will override any existing label assigned to the document.
Tip:If the ODS document does not exist, then it will be created.
CAUTION:
If the ODS document already exists, then it will be overwritten.
UPDATE
opens an ODS document and appends new content to the document. UPDATE provides Update access as well as Read access.
Interaction:If a label has been specified with the LABEL= option, then it will be assigned to the document.
Tip:If the ODS document does not exist, then the document will be created.
CAUTION:
If the document already exists, then its contents will not be changed.
Default:UPDATE
Note:Procedure output or data queries will be added at the end of the directory.
NAME= <libref.> member-name<(access-option)>
libref
specifies the SAS library where the document is stored.
Default:If no library name is specified, the Work library is used.
member-name
specifies the document name.
Default:If no NAME= is specified, the specified options apply to the currently open document.

If you do not specify an access-option with NAME=, then your directories will open in UPDATE mode.

access-option
specifies the access mode for the ODS document.
WRITE
opens a document and provides Write access as well as Read access.
Interaction:If a label has been specified with the LABEL= option, then it will override any existing label assigned to the document.
Tip:If the ODS document does not exist, then it will be created.
CAUTION:
If the ODS document already exists, then it will be overwritten.
UPDATE
opens an ODS document and appends new content to the document. UPDATE provides Update access as well as Read access.
Interaction:If a label has been specified with the LABEL= option, then it will be assigned to the document.
Tip:If the ODS document does not exist, then the document will be created.
CAUTION:
If the document already exists, then its contents will not be changed.
Default:UPDATE
Interaction:When a DOCUMENT destination is open, using the NAME= option in an ODS DOCUMENT statement forces ODS to close the destination and all files associated with it, and to open a new instance of the destination.