This SPSS tutorial explains how to use SPSS Automatic Recode to convert variable from string to number (from Nominal to Scale).
SPSS Automatic Recode
In SPSS, the ideal data source is to convert all nominal data to numeric data, and then use Value Labels to map the corresponding text, it is because many analysis cannot use nominal data.
Automatic Recode is a function to create a new column and automatically convert nominal variable from text to number. It also allows conversion of numeric variable to numeric value in ascending / descending order.
Assume that we have a variable gender, which contains values Female, Male, Unknown and blank
Navigate to Transform > Automatic Recode
Move the variable to the right box by clicking the arrow, and then type a new variable name in New Name. I use “test” in this example. Click on Add New Name button.
Gender–>??????? becomes Gender–>test
Click on OK
Go back to Data View, a new variable “test” is created.
Blank value is assigned as 1, Female as 2, Male as 3, Unknown as 4. This is because number is assigned in an ascending alphabetic order.
You can also assign number in descending alphabetic order by checking the Highest value option
Switch to Variable View > select the Value property of test column
You can see the mapping is defined here.
If you have check the box Treat blank string values as user-missing in Automatic Recode menu, blank data is assigned as the last number (4 is the last number in the example) and defined it as Missing.