How can missing values be replaced with zero in SPSS?

In SPSS, missing values can be replaced with zero by using the “RECODE” command. This allows the user to specify which variable or variables they want to replace missing values for, and then specify the value they want to replace it with, in this case, zero. This can be useful for data analysis and calculations, as it ensures that all values are accounted for and can be included in statistical calculations. Additionally, replacing missing values with zero can help maintain consistency in the data and prevent any errors or biases in the analysis.


Often you may want to replace missing values with zero in SPSS.

The easiest way to do this is by using Transform > Recode into Same Variables.

The following example shows how to do so in practice.

Example: How to Replace Missing Values with Zero in SPSS

Suppose we have the following dataset in SPSS that contains information about exam scores received by various students in some class:

Notice that there are several missing values in the Exam_Score column.

Suppose that we would like to replace each of these missing values with zeros.

To do so, click the Transform tab, then click Recode into Same Variables:

In the new window that appears, drag the Exam_Score variable into the Numeric Variables box:

Then click the Old and New Values button.

In the new window that appears, click the button next to System-missing under OId Value and then type 1 into the New Value box, then click the Add button:

SPSS replace missing values with zero

This new recoding rule will be shown in the Old –> New box.

Lastly, click Continue. Then click OK.

Note that in this example we only replaced missing values with zero in one column, but you can use this same process to replace missing values in as many columns as you’d like.

Additional Resources

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

x