Date: Fri, 27 Mar 2009 11:09:59 -0500
Reply-To: "Oliver, Richard" <roliver@spss.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Oliver, Richard" <roliver@spss.com>
Subject: Re: LPAD question
In-Reply-To: A<5E0F889A8147254F83D0250D0E7CE6C6E0DE61@DCSH15VX.root.sutterhealth.org>
Content-Type: text/plain; charset="US-ASCII"
try this instead:
newvar (a9).
compute newvar=concat('0000', rtrim(oldvar)).
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Parise, Carol A.
Sent: Friday, March 27, 2009 10:39 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: LPAD question
Hi all,
i think this will be a quick question for someone.
I have string data:
oldVAR
5678
13056
I need to put 4 leading 0s on these so that they look like this:
00005678
000013056
i thought the following would do the trick:
string newVAR(A9).
compute newVAR =LPAD(oldVAR,4,'0').
execute.
but, it's just returning the same numbers. what have i screwed up?
thanks a bunch.
Carol
=====================
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
|