substring command

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

substring command

Joanne Tsai
Dear colisters:
I have a simple question regarding to substring. These are the data
points I have.
I'd like to write a command that only read the number part of the string
variable, can anyone kindly help me with it? Thank you.

Before           ideal after
1003524         1003524
1003524         1003524
100561_         100561
100620_         100620
101425_         101425


Joanne

=====================
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: substring command

ViAnn Beadle
If the underscore is always on the right, look at the RTRIM function--eg.,
RTRIM(beforevar,'-'). If you have underscores to remove in other places,
look at the REPLACE function to replace the underscore with a null--eg.,
REPLACE(beforevar,'-','').

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Joanne Tsai
Sent: Tuesday, January 29, 2008 9:49 AM
To: [hidden email]
Subject: substring command

Dear colisters:
I have a simple question regarding to substring. These are the data
points I have.
I'd like to write a command that only read the number part of the string
variable, can anyone kindly help me with it? Thank you.

Before           ideal after
1003524         1003524
1003524         1003524
100561_         100561
100620_         100620
101425_         101425


Joanne

=====================
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