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
|