Data Subsetting

Using a Simple Subsetting Statement

Often, it is necessary to perform an analysis on only a subset of the participants in the dataset. For example, you might want to review the mean survey responses provided by just the female participants. A subsetting IF statement can be used to accomplish this, and the general form is presented here:

DATA  new-dataset-name;
   SET  existing-dataset-name;
IF  comparison;

PROC  name-of-desired-statistical-procedure   DATA=new-dataset-name;

The comparison described in the preceding statements generally includes an existing variable and at least one comparison operator. The following statements enable you to calculate the mean survey responses for only the female participants.

15 . 16 . 17 18 5433224 ...

Get A Step-by-Step Approach to Using SAS® for Univariate & Multivariate Statistics, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.