Date: Mon, 14 Sep 2009 11:34:35 -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: Format Integer to "003" in SAS
In-Reply-To: <ddd536e0-fbc4-4127-8fdb-593f4bfbf388@y36g2000yqh.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"
Do you really need the value stored in a character variable with leading
zeros or do you just want it displayed that way in your output?
Your text asks for two digits; your example shows three. Which is it?
-----Original Message-----
From: maryann
Sent: Friday, September 11, 2009 10:16 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Format Integer to "003" in SAS
How do I convert, format or cast an variable that will contain a
number (let's say 4) as "04"?
This variable will eventually be storing numbers from 1 to 30. I
need to show it as a two digits all the time. In the process I will
convert it from integer to varchar to show the 2 digits.
Here are more examples:
initial value desired value
1 001
6 006
9 009
13 013
and so on.
|