banner



How To Filter Data In Spss

SPSS FILTER temporarily excludes a selection of cases
from all data analyses.
For excluding cases from data editing, use Practise IF or IF instead.

  • SPSS Filtering Basics
  • Example 1 - Exclude Cases with Many Missing Values
  • Example ii - Filter on 2 Variables
  • Example 3 - Filter without Filter Variable
  • Tip - Commands with Born Filters
  • Warning - Data Editing with Filter

SPSS FILTER - Example Data

I'll use bank_clean.sav -partly shown beneath- for all examples in this tutorial. This file contains the data from a small bank employee survey. Feel gratuitous to download these data and rerun the examples yourself.

SPSS Filter Tutorial Variable View

SPSS Filtering Basics

Filtering in SPSS usually involves four steps:

  1. create a filter variable;
  2. activate the filter variable;
  3. run one or many analyses -such equally correlations, ANOVA or a chi-square examination- with the filter variable in effect;
  4. deactivate the filter variable.

In theory, any variable can be used as a filter variable. After activating it, cases with

  • zeroes,
  • user missing values or
  • system missing values

on the filter variable are excluded from all analyses until you conciliate the filter. For the sake of clarity, I recommend you simply employ filter variables containing 0 or 1 for each case. Enough theory. Let's put things into practice.

Example 1 - Exclude Cases with Many Missing Values

At the end of our data, we detect nine rating scales: q1 to q9. Possibly we'd similar to run a gene assay on them or use them every bit predictors in regression analysis. In whatever case, we may desire to exclude cases having many missing values on these variables. Nosotros'll offset just count them by running the syntax below.

*Create new variable property number of missings over q1 to q9.
compute mis_1 = nmiss(q1 to q9).

*Apply variable label.
variable labels mis_1 'Number of missings on q1 to q9'.

*Check frequencies.
frequencies mis_1.

Result

SPSS Frequency Table Without Filter

Based on this frequency distribution, we decided to exclude the 8 cases having 3 or more than missing values on q1 to q9. Nosotros'll create our filter variable with a simple RECODE as shown below.

*Recode mis_1 into filter variable.
recode mis_1 (lo thru 2 = ane)(else = 0) into filt_1.

*Apply variable characterization.
variable labels filt_1 'Filter out cases with 3 or more missings on q1 to q9'.

*Activate filter variable.
filter past filt_1.

*Reinspect numbers of missings over q1 to q9.
frequencies mis_1.

Result

SPSS Filter Frequency Table

Note that SPSS now reports 456 instead of 464 cases. The eight cases with 3 or more than missing values are even so in our data only they are excluded from all analyses. We can run into why in data view as shown below.

SPSS Active Filter In Data View

Case 21 has 8 missing values on q1 to q9 and we recoded this into zero on our filter variable.
The strikethrough its $casenum shows that case 21 is currently filtered out.
The status bar confirms that a filter variable is in effect. Finally, allow'due south deactivate our filter by simply running FILTER OFF. We'll leave our filter variable filt_1 in the information. Information technology won't bother usa in any way.

Case 2 - Filter on ii Variables

For another analysis, nosotros'd like to utilise only female person respondents working in sales or marketing. A good starting point is running a very unproblematic contingency table every bit shown below.

*Show values and value labels in subsequent output tables.
fix tnumbers both.

*Prove frequencies for job type per gender.
crosstabs gender by jtype.

Result

SPSS Crosstabs Example

As our table shows, we've 181 female respondents working in either sales or marketing. We'll now create a new filter variable holding only zeroes. We'll then set up it to ane for our case choice with a unproblematic IF command.

*Create filter variable holding only zeroes.
compute filt_2 = 0.

*Fix filter to i for females in job types 1 and two.
if(gender = 0 & jtype <= 2) filt_2 = 1.

*Apply variable label.
variable labels filt_2 'Filter in females working in sales and marketing'.

*Actuate filter.
filter by filt_2.

*Confirm filter working properly.
crosstabs gender by jtype.

Rerunning our contingency tabular array (not shown) confirms that SPSS now reports only 181 female cases working in marketing or sales. Also note that we now have 2 filter variables in our information and that'due south just fine but simply 1 filter variable can be active at any time. Ok. Allow's deactivate our new filter variable equally well with FILTER OFF.

Instance iii - Filter without Filter Variable

Experienced SPSS users may know that

  • TEMPORARY can "disengage" some information editing that follow it and
  • SELECT IF permanently deletes cases from your information.

By combining them you can circumvent the demand for creating a filter variable but for one analysis at the time only. The example below shows but that: the first CROSSTABS is limited to a selection of cases simply too rolls dorsum our example deletion. The second CROSSTABS therefore includes all cases again.

*Brand following transformation(s) temporary.
temporary.

*Delete cases unless gender = i & jtype = 3.
select if (gender = one & jtype = 3).

*Crosstabs includes only males in IT and rolls dorsum case selection.
crosstabs gender past jtype.

*Crosstabs includes all cases again.
crosstabs gender by jtype.

Tip - Commands with Born Filters

Something else you may want to know is that some commands have a born filter. These are

  • REGRESSION,
  • LOGISTIC REGRESSION,
  • Factor and
  • DISCRIMINANT.
SPSS Filter Built Into Regression Dialog

The dialog suggests yous can filter cases -for this command merely- based on but one variable. I suspect you can enter more complex atmospheric condition on the resulting /SELECT subcommand equally well. I haven't tried it.

In whatever case, I think these built-in filters tin can be very handy and information technology kinda puzzles me they're simply express to the 4 same commands.

Warning - Data Editing with Filter

Well-nigh data editing in SPSS is unaffected by filtering. For example, https://world wide web.spss-tutorials.com/how-to-compute-means-in-spss/ over variables -equally shown below- affects all cases, regardless of whatever filter is active. We therefore need Do IF or IF to restrict this transformation to a selection of cases. However, an active filter does affect functions over cases. Some examples that we'll demonstrate below are

  • adding a instance count with AGGREGATE;
  • computing z-scores for one or many variables;
  • adding ranks, or with RANK.

SPSS Data Editing Afflicted by Filter Examples

*Reactivate female sales filter.
filter by filt_2.

*Not affected by filter: add together mean over q1 to q9 to information.
compute mean_1 = hateful(q1 to q9).
execute.

*Affected by filter: add together case count to data.
aggregate outfile * style addvariables
/ofreq = n.

*Affected by filter: add z-scores salary to data..
descriptives salary
/save.

*Affected by filter: add median groups salary to data.
rank bacon
/ntiles(2) into med_salary.

Result

SPSS Filter And Data Editing

Correct. And so that'due south pretty much all about filtering in SPSS. I promise you found this tutorial helpful and

Cheers for reading!

How To Filter Data In Spss,

Source: https://www.spss-tutorials.com/spss-filter-tutorial/

Posted by: castillopairame.blogspot.com

0 Response to "How To Filter Data In Spss"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel