Subsetting Data

Deleting Unwanted Observations

You can specify any executable SAS statement in an IF-THEN statement. For example, you can use an IF-THEN statement with a DELETE statement to determine which observations to omit as you read data.
Syntax, DELETE statement:
To conditionally execute a DELETE statement, use the following syntax for an IF statement:
IF expression THEN DELETE;
The expression is evaluated as follows:
  • If it is true, execution stops for that observation. The DELETE statement deletes the observation from the output data set, and control returns to the top of the DATA step.
  • If it is false, the DELETE statement does not execute, and processing continues with the next statement in the DATA step. ...

Get SAS Certification Prep Guide, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.