If (Subsetting)

Contents Index


The subsetting if statement is used in conjunction with the set statement to remove data records from a data set.

Data records can be deleted from a data set using either the where statement or subsetting if statement. As an example, suppose the data set rain contains yearly rainfall by city for the years 1900-1994. The variables in the data set are year, rainfall, and city. Then

data aurain;
set rain;
if year >= 1970 and city='auburn';
run;

creates a new data set containing auburn rainfall data for the years 1970-1994.

The where statement provides more efficient processing than the subsetting if statement. However, SAS functions can NOT be used within the where statement, but are allowed in a subsetting if statement.


Contents Index

Copyright © 1997 by Jerry Alan Veeh. All rights reserved.