LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (August 2003, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 22 Aug 2003 11:57:10 -0400
Reply-To:     Robert Abelson <rabelson@KAI-RESEARCH.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Robert Abelson <rabelson@KAI-RESEARCH.COM>
Subject:      Re: Leading 0s and dates format
Content-Type: text/plain

Louis,

I think you're working too hard here. You can get what you need by doing this instead:

birth = put(datepart(birthdate),yymmddn8.);

HTH. Bob Abelson KAI Research, Inc. 6001 Montrose Rd. Suite 920 Rockville, MD 20852 T: 301-770-2730 F: 301-770-4183 rabelson@kai-research.com

> -----Original Message----- > From: Louis [SMTP:louis_rene_rheault@YAHOO.COM] > Sent: Friday, August 22, 2003 11:36 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Leading 0s and dates format > > Hello there! > > I'm trying to put a date in the format YYYYMMDD but I can't find a way. My > date is in format "DateTime20." and I tried: > birth = COMPRESS( > PUT( YEAR(DATEPART(birthdate)),Z4.)|| > PUT( MONTH(DATEPART(birthdate)),Z2.)|| > PUT( DAY(DATEPARTbirthdate)),Z2.) > ); > > It gives me the results: "194 1 13" for January 13th, 1940. > > Any idea? > Thanks very much! > > Louis


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