Chapter Contents |
Previous |
Next |
Language Reference |
var {time1 time5 time9}; /* a literal giving the variables */ var time; /* a matrix containing the names */ var('time1':'time9'); /* an expression */ var _all_; /* a keyword */The WHERE clause conditionally selects observations, within the range specification, according to conditions given in the clause. The general form of the WHERE clause is
^= ^? < <= > >= |
For the following operators, the WHERE clause succeeds if any of the elements in the matrix satisfy the condition:
= ? = : = * |
Logical expressions can be specified within the WHERE clause using the AND (&) and OR (|) operators. The general form is
clause&clause | (for an AND clause) | ||
clause|clause | (for an OR clause) |
where clause can be a comparison, a parenthesized clause, or a logical expression clause that is evaluated using operator precedence.
Note: The expression on the left-hand side refers to values of the data set variables and the expression on the right-hand side refers to matrix values.
The EDIT statement can define a set of variables and the selection criteria that are used to control access to data set observations. The NOBS clause returns the total number of observations in the data set in the variable name.
The VAR and WHERE clauses are optional and can be specified in any order. The NOBS clause is also optional.
See Chapter 6, "Working with SAS Data Sets," for more information on editing SAS data sets.
To edit the data set DAT, or WORK.DAT, use the statements
edit dat; edit work.dat;To control the variables you want to edit and conditionally select observations for editing, use the VAR and WHERE clauses. For example, to read and update observations for variable I where I is greater than 9, use the statement
edit work.dat var{i} where (i>9);Below is an example using the NOBS option.
/* if MYDATA has 10 observations, */ /* then ct is a numeric matrix with value 10 */ edit mydata nobs ct;
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.