Reputation: 565
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:
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:
Surely such a simple problem can be solved without using the syntax editor?
Im using SPSS version 19
Upvotes: 1
Views: 14636
Reputation: 11
You need to go from "data view" on the bottom tab to "variable view". Then you will look up and change the "type" from "string" to "numeric".
Upvotes: 1
Reputation: 1
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
Upvotes: 0
Reputation: 11
Try...
RECODE OldStringVar ("Missing" = "").
Or...
DO IF OldStringVar = "".
RECODE OldStringVar (ELSE = COPY) INTO NewStringVar.
END IF.
Or variations of this approach.
Upvotes: 1
Reputation: 1
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.
Upvotes: 0
Reputation: 1
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
Upvotes: 0
Reputation: 5536
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.
Upvotes: 4