DELETE Statement


Stops processing the current observation

Valid: in a DATA step

Category: Action

Type: Executable

Syntax

DELETE ;

Without Arguments

When DELETE executes, the current observation is not written to a data set, and SAS returns immediately to the beginning of the DATA step for the next iteration.

Details

The DELETE statement is often used in a THEN clause of an IF-THEN statement or as part of a conditionally executed DO group .

Comparisons

  • Use the DELETE statement when it is easier to specify a condition that excludes observations from the data set or when there is no need to continue processing the DATA step statements for the current observation.

  • Use the subsetting IF statement when it is easier to specify a condition for including observations.

  • Do not confuse the DROP statement with the DELETE statement. The DROP statement excludes variables from an output data set; the DELETE statement excludes observations.

Examples

Example 1: Using the DELETE Statement as Part of an IF-THEN Statement

When the value of LEAFWT is missing, the current observation is deleted:

 if leafwt=. then delete; 

Example 2: Using the DELETE Statement to Subset Raw Data

 data topsales;     infile  file-specification  ;     input region office product yrsales;     if yrsales<100000 then delete;  run; 

See Also

Statements:

  • 'DO Statement' on page 1143

  • 'DROP Statement' on page 1150

  • 'IF Statement, Subsetting' on page 1212

  • 'IF-THEN/ELSE Statement' on page 1213




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net