SPSS has a nice little feature for adding and averaging variables with missing data that many people don’t know about.
It allows you to add or average variables, while specifiying how many are allowed to be missing.
For example, a very common situation is a researcher needs to average the values of the 5 variables on a scale, each of which is measured on the same likert scale.
There are two ways to do this in SPSS syntax.
Newvar=(X1 + X2 + X3 + X4 + X5)/5 or
Newvar=MEAN(X1,X2, X3, X4, X5).
In the first method, if any of the variables are missing, due to SPSS’s default of listwise deletion, Newvar will also be missing.
In the second method, if any of the variables is missing, it will still calculate the mean. While this seems great at first, the researcher may wish to limit how many of the 5 variables need to be observed in order to calculate the mean. If only one or two variables are present, the mean may not be a reasonable estimate of the mean of all 5 variables.
SPSS has an option for dealing with this situation. Running it the following way will only calculate the mean if any 4 of the 5 variables is observed. If fewer than 4 of the variables are observed, Newvar will be system missing.
Newvar=MEAN.4(X1,X2, X3, X4, X5).
You can specify any number of variables that need to be observed.
(This same distiction holds for the SUM function in SPSS, but the scale changes based on how many are being averaged. A better approach is to calculate the mean, then multiply by 5).