| Date: | Wed, 3 Sep 2008 11:37:23 -0500 |
| Reply-To: | "./ ADD NAME=Data _null_," <iebupdte@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "./ ADD NAME=Data _null_," <iebupdte@GMAIL.COM> |
| Subject: | Re: Picture format |
|
| In-Reply-To: | <EDB6078EC27BC74290635465379F70D207AA9FE41C@EX-CMS01.westat.com> |
| Content-Type: | text/plain; charset=ISO-8859-1 |
I may be a NLS "feature". There is NLTIME that produces leading zero,
but does not like width 5.
84 proc format;
85 picture ztime low-high='%0H:%0M' (DATATYPE=TIME);
NOTE: Format ZTIME has been output.
86 run;
87 data _null_;
88 x = '05:45't;
89 put (3*x) (=time5. =ztime. =nltime.);
90 run;
x=5:45 x=05:45 x=05:45:00
On 9/3/08, Ed Heaton <EdHeaton@westat.com> wrote:
> Gerhard;
>
> I don't get it!
>
> 1 Data _null_ ;
> 2 Do x= "16:20"t , "2:27"t , "6:18"t ;
> 3 Put x time5. / x time8. / ;
> 4 End ;
> 5 Run ;
>
> 16:20
> 16:20:00
>
> 2:27
> 2:27:00
>
> 6:18
> 6:18:00
> NOTE: DATA statement used (Total process time):
> real time 0.20 seconds
> cpu time 0.00 seconds
>
> Where are the leading zeros?
>
> Ed
>
> Edward Heaton, Senior Systems Analyst,
> Westat (An Employee-Owned Research Corporation),
> 1650 Research Boulevard, TB-286, Rockville, MD 20850-3195
> Voice: (301) 610-4818 Fax: (301) 294-2085
> mailto:EdHeaton@Westat.com http://www.Westat.com
>
>
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Gerhard Hellriegel
> Sent: Wednesday, September 03, 2008 11:44 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: Picture format
>
>
> you don't need any user-format for that, TIME does exactly that, but only for time-variables (numeric). Gerhard
>
>
> On Wed, 3 Sep 2008 10:24:56 -0500, ./ ADD NAME=Data _null_, <iebupdte@GMAIL.COM> wrote:
>
> >From the documentation...
> >Any directive that generates numbers can produce a leading zero, if
> >desired, by adding a 0 before the directive. This applies to %d, %H,
> >%I, %j, %m, %M, %S, %U, and %y. For example, if you specify %y in the
> >picture, then 2001 would be formatted as '1', but if you specify %0y,
> >then 2001 would be formatted as '01'.
> >
> >
> >
> >On 9/3/08, Learner <pradev@gmail.com> wrote:
> >> Hi,
> >>
> >> I have a time variable with hours and minutes for example, 16:20,
> >> 2:27, 6:18 etc. I want to add zero if the length of the time variable
> >> is less than 5 like 02:27. Please let me know how to do this by using
> >> the picture format.
> >>
> >> Thank you,
> >> Learner
> >>
>
|