LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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...
Comments: To: nagabiochem@GMAIL.COM

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.

Toby Dunn

On Wed, 6 May 2009 03:36:49 -0700, naga <nagabiochem@GMAIL.COM> wrote:

>hi >when ever creating new varibale tthat too dates cases >u should use dates in date9. format > >check this once >data naga; >x='15may2009'd ; >y='06jun2009'd; >informat x y date9.; >run; >proc print data=naga; >format x date9. y ddmmyy10.; >run; > > > >On May 5, 10:42 pm, peesari.mah...@GMAIL.COM ("SUBSCRIBE SAS-L Joe H. >Smith") wrote: >> Hi all; >> >> I have the following code here..... >> data want; >> x=date(); >> y=date(); >> format x dtdate9. y ddmmyy10.; >> run; >> >> 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 above... >> >> x y >> 05May2009 05/05/2009 >> >> Thanks in Adv.

Back to: Top of message | Previous page | Main SAS-L page