In SPSS, how do I convert between numeric variables and string variables?
In SPSS, to convert a numeric variable to a string variable, use the
STRING() function. Since the default variable type in
SPSS is numeric, you need to define your string variable in
advance. Consider the following example:
In the example above,
A8 indicates a string variable
eight characters long, and
F2.0 is the format of output
values of variable
num. For example, F8.4 fills four
zeroes after the decimal point when the numeric variable
num is an integer.
To convert a string variable to a numeric variable
NUMBER() function, for example:
If you have questions about using statistical and mathematical software at Indiana University, email UITS Research Analytics (formerly known as the Stat/Math Center). Research Analytics is located on the IU Bloomington campus at Woodburn Hall 200, and is open for consultation by appointment Monday-Friday 9am-5pm. For more, visit Research Analytics on the web, or call 812-855-4724 (IUB) or 317-278-4740 (IUPUI).
Last modified on January 10, 2014.