| Date: | Thu, 20 Mar 2008 11:40:18 +0100 |
| Reply-To: | Carsten Pauck <carsten.pauck@googlemail.com> |
| Sender: | "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU> |
| From: | Carsten Pauck <carsten.pauck@googlemail.com> |
| Subject: | Re: removing leading zeros |
| In-Reply-To: | <BLU113-W574D743F4E28425365C12FAE000@phx.gbl> |
| Content-Type: | text/plain; charset=WINDOWS-1252 |
hello, this should work:
*strings are stored in the var first.
*removing the leading zeros.
string remZeros (a20).
comp remZeros = ltrim(first, '0').
exe.
*removing the last four chars (three letters and the dash).
string fin (a20).
comp fin = substr(remZeros,1, length(rtrim(remZeros))-4).
exe.
2008/3/20, Zahid Abbas <zahidabbas@live.com>:
> Hello,
> I have a variable that have data as:
> 0095-LIF
> 0099-SVW
> 0101-GEF
> 0106-FAM
> 0109-KAD
> 1110-JES
> 1111-SYB
>
> I want to remove the leading zeros, dash and last three letters so that
> the new variable looks like this
> 95
> 99
> 101
> 106
> 109
> 1110
>
> Thank you for your assistance.
>
> _________________________________________________________________
> Enter today for your chance to win $1000 a day—today until May 12th. Learn more at SignInAndWIN.ca
> http://g.msn.ca/ca55/215
> To manage your subscription to SPSSX-L, send a message to
> LISTSERV@LISTSERV.UGA.EDU (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
LISTSERV@LISTSERV.UGA.EDU (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
|