Date: Wed, 6 May 2009 10:12:06 -0400
Reply-To: Toby Dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Toby Dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Date Formats...
DTDate is a datetime format which means it requires a date and a time part
to work correctly.
Date values are the number of days since Jan 1, 1960
Datetime values are the number of seconds since Jan 1, 1960
So May 5, 2009 is equal to 18023 days since Jan 1, 1960
Now if we try to use a datetime format it will assume that the value is in
seconds not days and the 18023 will amount to way less than one days worth
of seconds and the format then pushes out the formatted value of 01JAN1960.
In short always know what type of value you have a date or datetime value
and then double check that you are using the correct format. In this
particular case as Naga pointed out Date9 does the trick.
On Wed, 6 May 2009 03:36:49 -0700, naga <nagabiochem@GMAIL.COM> wrote:
>when ever creating new varibale tthat too dates cases
>u should use dates in date9. format
>check this once
>informat x y date9.;
>proc print data=naga;
>format x date9. y ddmmyy10.;
>On May 5, 10:42 pm, peesari.mah...@GMAIL.COM ("SUBSCRIBE SAS-L Joe H.
>> Hi all;
>> I have the following code here.....
>> data want;
>> format x dtdate9. y ddmmyy10.;
>> MY O/P is ... x y
>> 01Jan1960 05/05/2009
>> Can you explain me why there is a difference in date values,when i am
>> using the same date function for both the variables..only my format type
>> is changing,if i want x to have a value of 05May2009,How can i get
>> this .My desired output ...if i use the same formats as mentioned
>> x y
>> 05May2009 05/05/2009
>> Thanks in Adv.