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:
DELETE;
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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.