Example 2: Creating a Compound Filter

This example creates an output data set of all the players who earn less than $750,000 and who are in the American League.
  1. In the Tasks section, expand the Data folder, and then double-click Filter Data. The user interface for the Filter Data task opens.
  2. For the input data source, select SASHELP.BASEBALL.
  3. To create the filter for salaries less than $750,000:
    1. Under the Filter 1 heading, assign Salary to the Variable 1 role.
    2. From the Comparison drop-down list, select Less than.
    3. From the Value type drop-down list, select Enter a value.
    4. In the Value box, enter 750.
    5. From the Logical drop-down list, select AND.
    6. To create the filter for players in the American League:
      1. Under the Filter 2 heading, assign League to the Variable 2 role.
      2. From the Comparison drop-down list, select Equal.
      3. From the Value type drop-down list, select Select distinct value.
      4. From the Value drop-down list, select American.
  4. Under the Output Data Set heading, select Show output data to view the output data set in the results. From the Show drop-down list, select Show all output data.
  5. To run the task, click Submit SAS Code.
Here is a subset of the results, which shows all the players in the American League who have a salary less than $750,000.
WORK.Filter Data Set