1
votes

I am strugling recoding missing values in SPSS using the graphical user interface. I can easily recode numeric variables using the GUI and the dialogue box shown below:

enter image description here

But when i enter a string variable into the same dialogue box the option to define the new value as "System-missing" is not available:

enter image description here

Surely such a simple problem can be solved without using the syntax editor?

Im using SPSS version 19

5
It really is a very bad idea to do this kind of stuff without using the syntax editor. What are you going to tell your client/teacher if they have doubts regarding your results? What if you accidentally mess up your data, will you go through all the mouse clicks again? Simply using Paste instead of Ok and saving all syntax you use is likely to save you from a lot of trouble. - RubenGeert

5 Answers

4
votes

It is because system-missing values are defined only for numeric variables. You can define user-missing values for strings. For example, recode to some unused string value, like "99999" and set the value "99999" as user-missing afterwards.

IBM SPSS Statistics 19 Command Syntax Reference, page 55:

System-missing values cannot be generated for string variables, since any character is a legal string value.

1
votes

Try...

RECODE OldStringVar ("Missing" = "").

Or...

DO IF OldStringVar = "".
RECODE OldStringVar (ELSE = COPY) INTO NewStringVar.
END IF.

Or variations of this approach.

0
votes

I had the same problem. I found the answer in that tutorial :

http://libguides.library.kent.edu/content_mobile.php?pid=481510&sid=4120229

Under "automatic recode"

"In fact, this is the only way to get SPSS to recognize missing values for string variables; otherwise, SPSS considers blank strings as valid values"

Please follow the above link for instructions. Thanks

0
votes

In code it can be done. Do the following (using an address field as example): - Generate a new temporary variable using "automatic recode", where the missing values at the old variable will be easily identified. Go to "Transform\Automatic Recode", double click the text variable (address), put a New Name (Addr_Temp) and click "Add New Name". Mark "Treat blank string values as user-missing" box and click Ok. In code:

AUTORECODE VARIABLES=Address 
    /INTO Addr_Temp
    /BLANK=MISSING
    /PRINT.

** Probably, the MISSING will be the last (highest) value, I'm not sure, but it's easy to certify. Now, let's say that this value is 94, what means there are 93 absolutely different valid values for address in your data and the fourth is the blank (imagine a data of where native people was born, in a city with 93 hospitals. There will be 93 different hospital addresses, and some blank for foreign people). Pay attention to special characters, maybe the last code will not be the blank field... Check first the recode list at output window. - Codify back the missing value as a know and unusual code, like 9999FFFF (or other impossible street address, in our addresses example), as follow:

RECODE Addr_Temp (94='9999FFFF') INTO Address.
EXECUTE.

Unfortunately this will not work in graphics interface, only syntax, at least in my version of SPSS (you can try in yours, just do the normal recode). It didn't accepted an existent variable

Now you have the value "9999FFFF" in the text field, instead of a blank value, and can be used as wished (including a manual recode). Just remember to recode this one to data missing when creating the final variable, or in the "automatic-recoded" one.

0
votes

First open syntax editor

MISSING VALUES NAME_VAR1,NAME_VAR2 (" "). EXECUTE

Now you can easily recode string variables using the GUI.

IMPORTANT!!! only with variables whose length is eight or less