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.
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.
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?
Specifying the filter condition using the IF statement. Note: the case IS sensitive within quotation.
If Enrol = "Yes";
*Note: The case IS sensitive within the quotation.
Enrol = "Yes" is different than
Enrol = "YES"