Previous Page | Next Page

SAS Data Set Options

WHEREUP= Data Set Option



Specifies whether to evaluate new observations and modified observations against a WHERE expression.
Valid in: DATA step and PROC steps
Category: Observation Control

Syntax
Syntax Description
Details
Examples
Example 1: Accepting Updates That Do Not Match the WHERE Expression
Example 2: Rejecting Updates That Do Not Match the WHERE Expression
See Also

Syntax

WHEREUP=NO | YES


Syntax Description

NO

does not evaluate added observations and modified observations against a WHERE expression.

YES

evaluates added observations and modified observations against a WHERE expression.


Details

Specify WHEREUP=YES when you want any added observations or modified observations to match a specified WHERE expression.


Examples


Example 1: Accepting Updates That Do Not Match the WHERE Expression

This example shows how WHEREUP= permits observations to be updated and added even though the modified observation does not match the WHERE expression:

data a;
   x=1;
   output;
   x=2;
   output;
run;

data a;
   modify a(where=(x=1) whereup=no);
   x=3;
   replace; /* Update does not match WHERE expression */
   output; /* Add does not match WHERE expression */
run;

In this example, SAS updates the observation and adds the new observation to the data set.


Example 2: Rejecting Updates That Do Not Match the WHERE Expression

In this example, WHEREUP= does not permit observations to be updated or added when the update and the add do not match the WHERE expression:

data a;
   x=1;
   output;
   x=2;
   output;
run;

data a;
   modify a(where=(x=1) whereup=yes);
   x=3;
   replace; /* Update does not match WHERE expression */
   output; /* Add does not match WHERE expression */
run;

In this example, SAS does not update the observation nor does it add the new observation to the data set.


See Also

Data Set Option:

WHERE= Data Set Option

Previous Page | Next Page | Top of Page