Previous Page | Next Page

The DOCUMENT Procedure

Using WHERE Expressions with the DOCUMENT Procedure


You can conditionally select a subset of entries in an ODS document for copying, listing, deleting, moving, or replaying by using WHERE expressions with the following statements:

COPY TO Statement

DELETE Statement

LIST Statement

MOVE TO Statement

REPLAY Statement

WHERE expressions have this form:

(WHERE=(where-expression-1 <operator where-expression-n>))
where-expression

is an arithmetic or logical expression that consists of a sequence of operators and operands.

operand

is one of the following:

constant

is a fixed value such as a date literal, a value, or a BY variable.

SAS function

For information on SAS functions, see SAS Language Reference: Dictionary.

subsetting variable

is a special kind of WHERE expression operand used by the DOCUMENT procedure to help you find common values in ODS documents. Here are the subsetting variables:

_CDATE_

is the creation date of the current entry.

Example: The following MOVE TO statement moves all entries of the type 'Graph' with a creation date of 16JUL2004 to the Monthly directory of WORK.MyDoc:
move ^(where=(_type_ = 'Graph' and _cdate_ = '16JUL2004'd)) to 
   \ work.mydoc\monthly; 
run;
_CDATETIME_

is the creation datetime of the current entry.

Example: The following COPY TO statement copies all entries with a creation datetime of May 1, 2003, at 9:30 to the Monthly directory of WORK.MyDoc:
copy ^(where=(_cdatetime_ = '01may04:9:30:00'dt)) to \work.mydoc\monthly; 
run;
_CTIME_

is the creation time of the current entry.

Example: The following DELETE statement deletes all entries with a creation time of 9:25:19 PM:
delete ^(where=(_ctime_ = '9:25:19pm't)); 
run;
_LABEL_

is the label of the current entry.

Example: The following LIST statement lists all tables containing the label 'Type III Model' within the GLM procedure:
list glm(where=(_type_ = 'table' _label_ ? 'Type III Model'));
run;
_LABELPATH_

is the path to the label of the current entry. Document label paths are formed by concatenating the labels and sequence numbers, and then separating them with the forward slash (/) symbol. Document label paths are similar to the label paths specified by the ODS TRACE statement.

For example, if the ODS TRACE label path is:

'The Univariate Procedure'.'Normal_x'.'Histogram 1'
The corresponding document label path is:
'The Univariate Procedure'#1\'Normal_x'#1\'Histogram 1'#1
Note that in document label paths, the instances of '.' are replaced with '\'.
Example: The following LIST statement lists all items containing "Fit Statistics" in the label path.
list gml(where=(_labelpath_ ? "Fit Statistics"))/levels=all;
run;
See also: ODS TRACE Statement
_MDATE_

is the modification date of the current entry.

Example: The following MOVE TO statement moves all entries of the type 'Graph' with a modification date of 16JUL2004 to the Monthly directory of WORK.MyDoc:
move ^(where=(_type_ = 'Graph' and _mdate_ = '16JUL2004'd)) to 
   \work.mydoc\monthly; 
run;
_MDATETIME_

is the modification datetime of the current entry.

Example: The following REPLAY statement replays all entries with a modification datetime of May 1, 2003, at 9:30:
replay ^(where=(_mdatetime_ = '01may04:9:30:00'dt)); 
run;
_MTIME_

is the modification time of the current entry.

Example: The following COPY TO statement copies all entries with a modification time of 9:25:19 PM to the Monthly directory of WORK.MyDoc:
copy ^(where=(_mtime_ = '9:25:19pm't)) to \work.mydoc\monthly; 
run;
_NAME_

is the name of the current entry.

Example: The following DELETE statement deletes all entries that contain the name "stemleng" within the GLM procedure:
delete glm(where=(_name_ ? 'stemleng'));  
_PATH_

is the path of the current entry.

Example: The following LIST statement lists all entries with a path containing the substring 'Anova' at all levels of the current directory:
list ^(where=(_path_ ? 'Anova'));
run;
_SEQNO_

is the sequence number of the current entry.

Example: The following REPLAY statement replays all entries that have a sequence number of 2 in the GLM procedure:
replay glm(where=(_seqno_ = 2));  
See also: Understanding Sequence Numbers
_TYPE_

is the type of the current entry.

Example: The following MOVE TO statement moves all entries of the type 'Graph' with a creation date of July 16, 2004, to the Monthly directory of WORK.MyDoc:
move ^(where=(_type_ = 'Graph' and _cdate_ = '16JUL2004'd)) to 
     \work.mydoc\monthly; 
run;
variable- name

is the name of a BY variable.

Example: The following MOVE TO statement moves all entries where the value of the variable Gender is 'F' to the Monthly directory of WORK.MyDoc:
move ^(where=(gender='F')) to \work.mydoc\monthly;
run;
operator

compares one variable with a value or another variable. operator can be AND, OR NOT, OR, AND NOT, or a comparison operator.

Comparison Operators
Symbol Mnemonic Equivalent Definition
= EQ Equal to
^= or ~= or ¬= or <> NE Not equal to
> GT Greater than
< LT Less than
>= GE Greater than or equal to
<= LE Less than or equal to

IN Equal to one from a list of values

Requirement: Enclose where-expression in quotation marks.
See also: You can use any expression that can be used in the WHERE= data set option. For information on expressions that you can use in the WHERE= data set option, see the WHERE= data set option in SAS Language Reference: Dictionary and "WHERE-Expression Processing" in SAS Language Reference: Concepts.

Previous Page | Next Page | Top of Page