replacing a strong with a number

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

replacing a strong with a number

Melissa Hunfalvay

Hi, I am trying to replace a string “UN” with a number 3750. How can I do that programmatically? Thank you

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: replacing a strong with a number

spss.giesel@yahoo.de
Hi,

untested: try something like

COMPUTE mystring = REPLACE(mystring,'UN','3750').
or
COMPUTE mystring_numeric = NUMBER(REPLACE(mystring,'UN','3750'), F8.0).

Mario Giesel
Munich, Germany




Am Montag, 8. Februar 2021, 21:49:03 MEZ hat Melissa Hunfalvay <[hidden email]> Folgendes geschrieben:





  


Hi, I am trying to replace a string “UN” with a number 3750. How can I do that programmatically? Thank you


===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: replacing a strong with a number

PRogman
In reply to this post by Melissa Hunfalvay
Or maybe with:

IF (myVar EQ "UN")   myVar = "3750".
VALUE LABELS myVar 3750 'UN'.
* The variable myVar is still a string. If you want it to be numeric (and
all other values are numeric in  strings) use:  *.
ALTER TYPE myVAR (F8.0).

HTH, PR



Melissa Hunfalvay wrote
> Hi, I am trying to replace a string "UN" with a number 3750. How can I do
> that programmatically? Thank you
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD