Page 1

Table of Contents How to Code, Replace and Define Missing Values in SPSS .......................................... 2 1.1 Code missing values .................................................................................................................. 2 1.2 Replace missing values with the code ...................................................................................... 3 Replace missing values in 5 simple steps ..................................................................................... 3 1.3 Define missing values (important!) ........................................................................................... 5

Additional Resources.................................................................................................. 7

Created by ASK (2012)

Page 1 of 7


How to Code, Replace and Define Missing Values in SPSS In this tutorial it is assumed that you have used SPSS before, know how to enter and define variables, know how to enter data and are also familiar with the concept of coding variables. You may need to brush up on these using other resources available on Blackboard.

1.1 Code missing values You may be able to use the same number for all variables with missing values or you may need to choose a difference number for each variable, depending on the data that you have. In either case, choose a number which is not in the dataset. Most of the time I choose 99 or 999 as a code for missing values. However, when it is possible for either of these values to occur in the dataset then I choose something else, like 0 or -1. Example In my data file (Figure 1), I have 5 variables from a questionnaire:  ParticipantID  Gender: 0 = Male, 1 = Female  TravelTime: How long in minutes it takes each participant to travel to Uni.  Mode: The main mode of transport used by the participant to commute to Uni (1 = tfl, 2=car, 3 = cycle and 4 = walk)  Stress: The level of agreement with the following statement, “My commute causes me to feel stressed” (1 = Strongly disagree, 2 = Disagree, 3 = Neutral, 4 = Agree, 5 = Strongly Agree).

Figure 1. My data file with missing values. Created by ASK (2012)

Page 2 of 7


Three of my variables have missing values (Gender, TravelTime and Stress). What code should I use for these missing values? 

99 or 999: Because it is possible for someone to have a commute to uni (TravelTime) of 99 minutes, I cannot use 99 as my code for missing values for this variable. Also, just so I make sure there is no confusion, I will not use 999 either. I could however, use either 99 or 999 to code Gender and Stress as neither of these values are possible for these variables.

0: I have used 0 to code Gender and it is possible for someone to have a travel time of 0 minutes (if they live on campus and don’t have to commute), so I will not use 0.

-1: Neither Gender nor Stress have -1 included in the coding and it is not possible to have a travel time of -1 minutes.

Conclusion: I could use -1 as the code for all missing values, but I prefer to use 99 to code Gender and Stress (so I can easily spot them in the data) and -1 to code TravelTime.

1.2 Replace missing values with the code If you have a small enough dataset, you can do this manually (it’s up to you what is ‘small enough’). Simply enter the code into the empty cells in your dataset. If you have a larger dataset, or just don’t want to do it manually, you can replace missing values using SPSS. Replace missing values in 5 simple steps 1. From the Transform menu select Recode into same variables. 2. Select the variable(s) that will have the same code for missing values (e.g., Gender and Stress) and move them into the Numeric Variables box (see Figure 2). 3. Click Old and New Values. 4. From the left, select System- or user-missing (if you’re replacing empty cells then your values are ‘user-missing’). On the right, under New Value, enter your missing value code; my code is 99 (see Figure 3). Then Click Add so that MISSING-->99 appears in the Old-->New box. 5. Finally, click Continue, then OK. Repeat these steps for all other variables that need missing values to be replaced with a code. Figure 4 shows my data set after replacing all missing values.

Created by ASK (2012)

Page 3 of 7


Figure 2. Transform menu -> Recode into Same Variables dialogue box.

Make sure to click Add or your missing values will not be replaced.

Figure 3. Define Old and New Values, then click Add.

Created by ASK (2012)

Page 4 of 7


Figure 4. My data file after replacing missing values with a code.

1.3 Define missing values (important!) From the Variable View make sure to define your missing value codes (see Figure 5). That is, you must tell SPSS that your codes represent missing data otherwise they will be included in your analysis! Let’s define the code for Gender. 1. Click into the cell under Missing for Gender (Figure 5). Click the box shown in Figure 6.

to view the dialogue

2. Choose Discrete missing values (discrete just means “whole number” – a number without any decimal places). (See Figure 6). 3. Enter the missing value code(s) into the space(s) provided. I have entered 99 because this is my missing value code for Gender (Figure 6). 4. Click OK. Repeat these steps for all other variables for which you have coded missing values.

Created by ASK (2012)

Page 5 of 7


Figure 5. Define missing value for Gender.

Figure 6. Enter the code as a Discrete missing value.

Created by ASK (2012)

Page 6 of 7


Additional Resources In the Getting Started folder under the SPSS resources section, you may be interested in the following: 1. How to enter and define variables 2. How to enter your data into SPSS 3. How to code categorical variables 4. Levels of Measurement (nominal, ordinal and scale variables) * If you are unsure about which variables are categorical, have a look at the Levels of Measurement guide mentioned above.

Return to: 1.1 Code missing values 1.2 Replace missing values with the code 1.3 Define missing values (important!)

Created by ASK (2012)

Page 7 of 7

Code, replace and define missing values in SPSS  

This tutorial shows you how to code, replace and define missing values in SPSS

Read more
Read more
Similar to
Popular now
Just for you