SPSS Select Cases (filter data)

This SPSS tutorial explains how to filter data using Select Cases Function.

SPSS Select Cases (filter data)

In Excel, you can apply Autofilter and enter criteria to select data what you want. SPSS has similar function but it is called “Select Cases“. In this tutorial, we will talk about the options are available to facilitate data filtering.

Navigate to Data > Select Cases

SPSS select cases 01

 

There are several options in this Select Cases box. We will talk about each option in the below section.

SPSS select cases 02

 

SPSS Select Cases – If condition is satisfied

This option allows you to select data based on criteria.

Select the first option If condition is satisfied > click on If… button

SPSS select cases 03

 

For example, if we only want to use data where Salary is larger than 20000, then we type the followings in the text box

Type Salary > 20000

Press Continue button > Press OK button to exit the Select Cases dialog box

SPSS select cases 05

You can also use AND OR operator in the Text Box, for example

Salary>20000 AND Allowance=0    (0 can represent Null data)

 

Now you can see row 6 and row 8 (salary = 9545) have a slash on the row number. The slash means those rows are excluded in the dataset.

When you run statistics report, you will only find the population size N is only 6.

SPSS select cases 06

 

SPSS Select Cases – Random sample of cases

This option allows you to randomly select rows in the data.

Select the second option Random sample of cases > click on Sample… button

SPSS select cases 07

 

The first option is to filter a certain percentage of cases. But note that it is only “Approximately”, the number of cases filtered could vary significantly.

SPSS select cases 08

 

Lets say we enter 50% in the box. Go back to Data View and you can see only 3 cases out of 8 cases are filtered.

SPSS select cases 09

 

Go back to the previous screen and select the second option. Enter 4 cases from the first 7 cases. Click on Continue button and go back to Data View.

SPSS select cases 10

 

Now you can see 4 random rows from row 1 to 7 remain.

SPSS select cases 11

 

SPSS Select Cases – Based on time or case range

This option allows you to filter specific row number range.

Select the third option Based on time or case range > click on Range button

SPSS select cases 12

 

Enter 2 and 6 as follows

SPSS select cases 13

 

Go back to Data View, now you can see only row 2 to row 6 are left.

SPSS select cases 14

 

SPSS Select Cases – Use filter variable

This option is to manually select which row of data to include or exclude.

First, in Variable View, create a field called filterA

In the Select Cases Option, select the forth option Use filter variable and then move filterA to the box

SPSS select cases 15

 

Go back to Data View. Now you can enter “1” in filterA column to indicate you want to include that row of data, enter 0 (or Null input) to exclude data.

SPSS select cases 16

 

Outbound References

https://www.youtube.com/watch?v=5AVWlYyPnQo

 

Wyman W
Wyman is a Business Analyst based in Hong Kong, specialized in creating custom Function and Sub solutions, and is proficient in report automation with Access.

He is also a:
- Microsoft Most Valuable Professional (Excel)
- Microsoft Community Contributor
- Microsoft Office Specialist
- Microsoft Specialist
- Microsoft Technical Associate
- Microsoft Certified Professional
- IBM SPSS Specialist

Leave a Reply

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