Search code examples
stringreplaceanalysisnumericspss

SPSS replace missing values


I have some data with 15 variables, including some missing values. When I tried to look at the Frequency charts with the count and percentages of missing values, it was showing all variables without any missing values. In the variable view, I changed the "Missing" column from "None" to "Discrete" missing values, which was "?" to include the missing values. This showed the correct numbers of missing values for each variable.

I then went to Transform > Replace Missing Values to replace these missing values, but the only variables that appear as an option are the variables that are not missing any values. I tried going back to the variable view and changing all of the "Missing" column values back to "None" from "?", but that didn't help.

All of the variables that do appear in the Replace Missing Variables box are also numeric. Is that the problem - that the variables I want to replace are strings? If so, how can I handle these missing string values in my data?


Solution

  • The dialogue you are discussing is for imputation techniques for missing data. Such as the mean or the median of the series or nearby points (the specific command is RMV) and so it is only applicable for numeric data.

    One way to replace missing values for string variables is to use the RECODE command, example shown below.

    DATA LIST FREE / X (A5).
    BEGIN DATA
    A
    B
    ?
    C
    ?
    END DATA.
    
    MISSING VALUES X ('?').
    RECODE X (MISSING = '!').