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
I think you're working too hard here. You can get what you need by doing
birth = put(datepart(birthdate),yymmddn8.);
KAI Research, Inc.
6001 Montrose Rd.
Rockville, MD 20852
> -----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!