How can I change a string variable into a numeric one?
Sometimes a data set with a variable that appears to be a numerical variable is actually a string variable.You can't perform most statistical operations on a string variable.Consider the data set.
We can't calculate a mean for this variable because it's a string variable.There are a number of ways that you can change a string variable.The number function can be used with the compute command.You need to use the compute command to create a new variable.The name of the variable and format for the new variable are required to use the number function.
We can calculate some descriptive statistics now that we have the scores in a numerical variable.
The recode command can be used to convert string representations of values into a variable.
You may have non-numeric symbols in your string variable.You can use this command to convert them into numbers.
If you only have a few values in your string variable, you could use the recode command to create a new variable.The string variable gender can be converted into a numerical variable.
The autorecode command can be used to recode gender, or any string variable for which you want a numerical representation of the categories.
We recommend that you convert or recode your variables so that the original variable is not changed in any way.If the converting or recoding doesn't work the way you want it to, you can try it again.
The Command Syntax Reference is where you can find information about the types of variables available in SPSS.Click on "Universals" and then "Variable Types and Formats".The "f" stands for floating point, which means that the variable will benumeric.The "8" and "2" mean that the variable will have a length of 8 and 2 digits after the decimal point.To be completely explicit, this means that there can be up to five digits before the decimal place, and one and two digits after it, for a total of eight.
You can use something like (a10) if you want to specify a string variable.The string variable will have a length of 10 if the "a" and "10" are used.
You must have a valid email for us to receive the report.Comment or error report is required.