SPSS: How to Select Cases Based on Multiple Conditions


Often you may want to select cases based on multiple conditions in SPSS.

Fortunately this is easy to do by using the AND and OR operators in the Select Cases dialogue box.

The following examples show how to do so with the following dataset in SPSS that contains information about various basketball players:

Let’s jump in!

Example 1: Select Cases Using AND Operator

Suppose we would like to select all of the cases in the dataset that have a value of “Mavs” in the Team column and have a value of “Forward” in the Position column.

To do so, click the Data tab and then click Select Cases:

In the new window that appears, click the button next to If condition is satisfied, then click the If button:

In the new window that appears, type the following formula into the dialogue box:

Team='Mavs' AND Position='Forward'

SPSS select cases using AND operator with multiple conditions

Then click Continue. Then click OK.

All of the cases that fail to meet both of the criteria we specified will be crossed out:

Also note that a new column named filter_$ has been created that contains a value of 1 for cases that meet both criteria we specified and a value of 0 for cases that didn’t meet both criteria.

Example 2: Select Cases Using OR Operator

Suppose we would like to select all of the cases in the dataset that have a value of “Mavs” or “Rockets” in the Team column.

To do so, click the Data tab and then click Select Cases:

In the new window that appears, click the button next to If condition is satisfied, then click the If button:

In the new window that appears, type the following formula into the dialogue box:

Team='Mavs' OR Team='Rockets'

Then click Continue. Then click OK.

The cases that fail to meet at least one of the criteria we specified will be crossed out:

Also note that a new column named filter_$ has been created that contains a value of 1 for cases that meet at least one of the criteria we specified and a value of 0 for cases that didn’t meet either criteria.

Additional Resources

The following tutorials explain how to perform other common operations in SPSS:

How to Recode Variables in SPSS
How to Replace Missing Values with Zero in SPSS
How to Calculate Percentiles in SPSS

Leave a Reply

Your email address will not be published. Required fields are marked *