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 (October 1999, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 8 Oct 1999 09:29:03 -0400
Reply-To:   Victor Kamensky <kamensky@AECOM.YU.EDU>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Victor Kamensky <kamensky@AECOM.YU.EDU>
Subject:   Re: What is the correct date format?
Comments:   To: SAS-L@UGA.CC.UGA.EDU
Content-Type:   text/plain; charset="us-ascii"

>I have never understood why date() or today().....[something] always requires >one to add an extra digit and I guess now is as good a time as any to learn.

???What do you mean by "extra digit"?

6 data _null_; 7 newdate=translate(trim(left(put(date(),worddatx12.))),'-',' '); 8 put newdate=; 9 RUN;

NEWDATE=8-Oct-1999 NOTE: The DATA statement used 0.0 seconds.

It is 6.12 ,Win 95

Victor Kamensky Programmer Albert Einstein College of medicine

>X-Lotus-FromDomain: PH@N1 >Newsgroups: bit.listserv.sas-l >Date: Thu, 7 Oct 1999 16:34:25 -0400 >Reply-To: frank.mwaniki@PHARMA.NOVARTIS.COM >Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> >From: frank.mwaniki@PHARMA.NOVARTIS.COM >Subject: Re: What is the correct date format? >Comments: To: Robert J Krajcik <robert.krajcik@BMS.COM> >To: SAS-L@LISTSERV.UGA.EDU > >Bob, > >Interesting transformation. However, why does the date change just from the >transformation? Check this out: > >37 >38 data _null_; >39 x = '08jun1999'd; >40 put x=worddatx12.; >41 RUN; > >X=8 Jun 1999 >NOTE: The DATA statement used 0.07 seconds. > > >42 >43 data _null_; >44 x = '08jun1999'd; >45 newdate=translate(trim(left(put(date(),worddatx12.))),'-',' '); >46 put newdate=; >47 RUN; > >NEWDATE=7-Oct-1999 >NOTE: The DATA statement used 0.11 seconds. > >However, this yields expected results: > >64 >65 data _null_; >66 x = '08jun1999'd; >67 newdate=translate(trim(left(put(date()+1,worddatx12.))),'-',' '); >68 put newdate=; >69 RUN; > >NEWDATE=8-Oct-1999 >NOTE: The DATA statement used 0.13 seconds. > >I have never understood why date() or today().....[something] always requires >one to add an extra digit and I guess now is as good a time as any to learn. > > > > > > > >Robert J Krajcik <robert.krajcik@BMS.COM> on 10/07/99 04:05:54 PM > >Please respond to Robert J Krajcik <robert.krajcik@BMS.COM> > >To: SAS-L@LISTSERV.UGA.EDU >cc: (bcc: Frank Mwaniki/PH/Novartis) >Subject: Re: What is the correct date format? > > > > >And if you still insist on seeing the dashes, >try > >> 26 data _null_; >> 27 newdate=translate(trim(left(put(date(),worddatx12.))),'-',' '); >> 28 put newdate=; >> 29 run; >> >> NEWDATE=7-Oct-1999 >> replace the date() function with the SAS date you want. >> >> Rob Krajcik >> > >BOWLESJ1 wrote: > >> Ya, >> >> If you can live with spaces instead of dashes between the day, month, and year >> elements, >> try using the WORDDATX format: >> >> 42 data _null_; >> 43 x = '08jun1999'd; >> 44 put x=worddatx12.; >> 45 RUN; >> >> X=8 Jun 1999 >> >> Hope this helps! >> >> Judy Bowles >> bowlesj1@westat.com >> >> ____________________Reply Separator____________________ >> Subject: What is the correct date format? >> Author: Ya Huang <Y.Huang@ORGANONINC.COM> >> Date: 10/7/1999 1:13 PM >> >> Hello all, >> >> Is there a exsiting date format that can display a >> date like '08-jun-1999'? If I use format date9., I'll >> get an output '08jun1999' without the '-'. >> >> Thanks >> >> Ya Huang >> >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> >> <HTML> >> <HEAD> >> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> >> <META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2650.12"> >> <TITLE>What is the correct date format?</TITLE> >> </HEAD> >> <BODY> >> >> <P><FONT SIZE=2>Hello all,</FONT> >> </P> >> >> <P><FONT SIZE=2>Is there a exsiting date format that can display a</FONT> >> <BR><FONT SIZE=2>date like '08-jun-1999'? If I use format date9., I'll</FONT> >> <BR><FONT SIZE=2>get an output '08jun1999' without the '-'. </FONT> >> </P> >> >> <P><FONT SIZE=2>Thanks</FONT> >> </P> >> >> <P><FONT SIZE=2>Ya Huang</FONT> >> </P> >> >> </BODY> >> </HTML> > > >Attachment Converted: "C:\ALNET_WS\EUDORA\ATTACH\att1.htm" >


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