


DELETE statement

From sasCommunity
Jump to: navigation, search

There are two different usage contexts for the DELETE statement; one is in the DATA Step while the other is in the DATASETS procedure.

In the DATA Step

The DELETE statement is used in a DATA step to remove, or drop, an input observation from the output data set(s).

Despite its name, the DELETE statement does not delete data, rather it skips further processing of the current input record(s) and begins the next iteration of the DATA step without generating an output record.




The DELETE statement cause the current iteration of a DATA step to end without an output record being produced and causes DATA step processing to return to the beginning of the DATA step so the next input record can be processed.

If a DELETE statement is encountered during a DATA step iteration, no further processing of that iteration takes place, and control returns to the beginning of the DATA step to commence the next iteration. DATA step statement after a DELETE statement will only be executed if the DELETE statement is executed conditionally, such as the result of an IF statement, or the subsequent statements are referred to by a preceeding statement such as via a statement label or a reference to data lines.

In the DATASETS procedure

In the DATASETS procedure, the DELETE statement is used to delete one or more datasets.


DELETE <Dataset list> ;
See DATASETS procedure for more information about that DELETE statement.