Data Set [7-14]

Subsetting Data Set

In some cases, you may want to filter the data set and keep only a subset of the original data. 

This can be done by using the IF statement.

The TEST data set above contains 3 observations: 2 Males and 1 Female.


Data TEST3;
    Set Test;
    IF Gender = "Male";

The IF statement allows you to keep only the observations that meet the specified condition(s). 

In this example, only the "Male" observations are kept in the TEST3 data set. The "Female" observations are removed.

(Try it!)


Create a new data set called ENROL based on the PROFILE data set. ENROL should contains only the patients enrolled in the study (ENROL = YES)

*The PROFILE data set should have been created in Module 5-14. If you haven't done so, please go back and create the data set before working on this exercise.

Need some help?

Get Hint

Get Solution