How to convert string to numeric in SPSS

Suppose you have a string variable type data and you wish to convert it to numeric.

Go to File > New > Syntax . In SPSS Syntax Editor, paste the following syntax :

code          numcode
12348        12348.00
12457        12457.00

Number of cases read:  2    Number of cases listed:  2


1. DATA LIST defines a raw data file . The keyword FREE indicates multiple cases can be entered on a single row (freefield format).
2. Variable definition begins after the slash. Code is the variable name and A12 indicates string variable type with width 12
3.The BEGIN DATA and END DATA commands enclose the raw data.
4. With RECODE, you can change the values of an existing variable.
5. With CONVERT keywordyou can convert a variable type from string to numeric.
6. With INTO keyword, you can recode values of a variable into a new variable

Numeric conversion into the same variable
RECODE code (CONVERT) INTO numcode.
RENAME VARIABLES (numcode = code).

Love this Post? Spread the Word!
Comment and share to motivate us to write more!
About Author:

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has over 8 years of experience in data science. During his tenure, he has worked with global clients in various domains like Banking, Insurance, Telecom and Human Resource.

Get Free Email Updates :
*Please confirm your email address by clicking on the link sent to your Email*
Related Posts:
0 Response to "How to convert string to numeric in SPSS"

Post a Comment

We have Zero Tolerance to Spam. Comments with links will be deleted immediately upon our review.

Next → ← Prev
Scroll to Top