logo Getting Started with SAS Main menuGlossaryBackNext
    

Overview

Often you need to work with only a subset of a SAS data set. You may need to select observations, variables, or both.

Subsetting data

In the DATA step, you have a number of tools for subsetting data. You can use

  • subsetting IF statements to select only those observations that meet a specified condition
  • IF-THEN/ELSE constructs with DELETE and OUTPUT statements to delete or select observations that meet a condition, respectively
  • DROP= and KEEP= data set options and DROP and KEEP statements to drop or keep selected variables
  • WHERE statements to select only those observations that meet a specified condition (under certain circumstances).

In PROC steps, WHERE statements are the most common tool for selecting observations that meet a specified condition.

This task focuses on writing DATA steps using subsetting IF statements, the DROP= and KEEP= data set options, and the DROP and KEEP statements.



Main menuGlossaryBackNext