Converting a string variable to numeric by syntax.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Converting a string variable to numeric by syntax.

Staffan Lindberg

Dear list!

 

What is the proper syntax for converting an existing string variable to numeric? I’ve tried with Numeric but get the error message that the variable already exists.

 

best

 

Staffan Lindberg

Sweden

Reply | Threaded
Open this post in threaded view
|

Re: Converting a string variable to numeric by syntax.

Jon K Peck
Converting a value to numeric does not mean that you can assign it to a string.  You would need a new variable.  Use ALTER TYPE to change the type of an existing variable.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Staffan Lindberg <[hidden email]>
To:        [hidden email],
Date:        01/12/2014 08:32 AM
Subject:        [SPSSX-L] Converting a string variable to numeric by syntax.
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Dear list!
 
What is the proper syntax for converting an existing string variable to numeric? I’ve tried with Numeric but get the error message that the variable already exists.
 
best
 
Staffan Lindberg
Sweden
Reply | Threaded
Open this post in threaded view
|

Re: Converting a string variable to numeric by syntax.

David Marso
Administrator
In reply to this post by Staffan Lindberg
Why would Numeric do this?  Random clicking on functions is a sad second to reading the FM.
Look up ALTER TYPE and also NUMBER functions under COMPUTE.

Staffan Lindberg wrote
Dear list!



What is the proper syntax for converting an existing string variable to
numeric? I've tried with Numeric but get the error message that the variable
already exists.



best



Staffan Lindberg

Sweden
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"