Date: Mon, 12 May 2003 14:35:13 -0700
Reply-To: "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Subject: Re: left padding a string and then chopping it from right
Content-Type: text/plain; charset="iso-8859-1"
If the data is truly text, then the following will work
text = substr(substr('000000000000',1,12-length(text))||text,2);
-----Original Message-----
From: jason@CYBERPINE.COM [mailto:jason@CYBERPINE.COM]
Sent: Monday, May 12, 2003 1:24 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: left padding a string and then chopping it from right
Pardon another newbie question as feel my away around the language.
I've searched the online reference index and the list servers and
clearly must be misguided in my search.
I have a text string that will have 5 to 11 numeric digits. I need
the text string to always be 11 digits long with zeros padded to the
left. So...
55203 becomes 00000055203
and
552 becomes 00000000552
|