|
Chapter Contents |
Previous |
Next |
| Language Reference |
marks observations for deletion
The inputs to the DELETE statement are as follows:
You can specify range by using a keyword or by record number using the POINT operand. The following keywords are valid values for range:
| Operand | Example |
| a single record number | point 5 |
| a literal giving several | point {2 5 10} |
| record numbers | |
| the name of a matrix | point p |
| containing record numbers | |
| an expression in parentheses | point (p+1) |
The WHERE clause conditionally selects observations that are contained within the range specification. The general form of the WHERE clause is
In the statement above,
| = ? < <= > >= |
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 AND 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.
Here are several examples of DELETE statements:
delete; /* deletes the current obs */ delete point 34; /* deletes obs 34 */ delete all where(age<21); /* deletes obs where age<21 */You can use the SETOUT statement with the DELETE statement as follows:
setout class point 34; /* makes CLASS current output */ delete; /* deletes ob 34 */Observations deleted using the DELETE statement are not physically removed from the data set until a PURGE statement is issued.
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.