Chapter Contents |
Previous |
Next |
IF, Subsetting |
Valid: | in a DATA step |
Category: | Action |
Type: | Executable |
Syntax | |
Arguments | |
Details | |
Comparisons | |
Examples | |
See Also |
Syntax |
IF expression; |
Details |
The subsetting IF statement causes the DATA step to continue processing only those raw data records or those observations from a SAS data set that meet the condition of the expression that is specified in the IF statement. That is, if the expression is true for the observation or record (its value is neither 0 nor missing), SAS continues to execute statements in the DATA step and includes the current observation in the data set. The resulting SAS data set or data sets contain a subset of the original external file or SAS data set.
If the expression is false (its value is 0 or missing), no further statements are processed for that observation or record, the current observation is not written to the data set, and the remaining program statements in the DATA step are not executed. SAS immediately returns to the beginning of the DATA step because the subsetting IF statement does not require additional statements to stop processing observations.
Comparisons |
if not (expression) then delete;
Examples |
F
for the variable SEX:
if sex='F';
if age;
See Also |
Data Set Options:
| |||||||
Statements:
| |||||||
"WHERE Processing" in SAS Language Reference: Concepts |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.