


Now that you’ve created the variable, you can convert the numeric value to its string counterpart.ĬOMPUTE String_zip2=STRING(Numeric_zip,N5). The following creates a string variable named String_Zip2 with a width of five characters: If you need to convert a numeric value to a string there is one additional step: you must first declare the string variable. Numeric Variables to String Variables with SPSS

Now you’ll see the Numeric_Zip variable is set to be Nominal:Īs a reference, below are the other variable levels supported in SPSS This can be achieved with the following line of syntax:
Convert spss code to r zip#
To help remind yourself not to take the “average” of zip code you might want to change the variable level to Nominal. This gets us what we want however, as can be seen in the screenshot below, the new “Numeric_Zip” variable is currently set as a “Scale” variable. RECODE String_Zip (Convert) INTO Numeric_zip. Let’s say you wish to convert the variable named “String_Zip” to a numeric variable entitled “Numeric_zip.” The following is the SPSS syntax that would create the new variable: As long as the values are numbers with spaces on either side, this is very easy to accomplish. While Alchemer allows for changing of variable format inside the tool, occasionally I end up with string variables that really want to be numeric.
Convert spss code to r how to#
In this article Joe Glines, an SPSS pro with years of experience in data analysis, offers his quick tricks on how to manipulate the SPSS data we receive from Alchemer String Variables to Numeric with SPSS It is, however, an intricate process that demands a high level of expertise. With its emphasis on analyzing statistical data, SPSS is a powerful tool for manipulating survey data.
