Date: Thu, 5 Nov 2009 16:10:09 -0800
Reply-To: "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Subject: Re: Converting yyyymmdd
In-Reply-To: <a7fa8190-11ab-46b8-8594-9bd06c341912@u13g2000vbb.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"
You said you had a numeric date variable. 20091005 is not a numeric date variable as SAS uses the term. You can convert that value to a date value with the expression
INPUT(PUT(your-numeric-variable,8.),YYMMD8.)
If the value does not have time, why do you want a DATETIME19. format instead of one of the date formats?
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Sdlentertd
Sent: Thursday, November 05, 2009 2:08 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Converting yyyymmdd
On Nov 5, 1:22 pm, barry.a.schw...@BOEING.COM ("Schwarz, Barry A")
wrote:
> The PUT function will convert the numeric value to character.
>
> The YEAR and MONTH functions will extract the corresponding values from a date value.
>
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SA...@LISTSERV.UGA.EDU] On Behalf Of Sdlentertd
> Sent: Thursday, November 05, 2009 11:46 AM
> To: SA...@LISTSERV.UGA.EDU
> Subject: Converting yyyymmdd
>
> I would like to do two things to yyyymmdd NUMERIC date.
>
> 1)convert numeric yyyymmdd into DATETIME19. character.
>
> 2) extract Month and year from NUMERIC yyyymmdd so Month will by
> numeric ( 1 2 3 4...) and the year would be numeric (2001 2003 2007
> etc.)
>
> Thank you.- Hide quoted text -
>
> - Show quoted text -
THIS STATEMENT DOES NOT WORK dt = dhms(sasdate,0,0,0);
This date 20091005 shows up as 1570320000 and not what I need
05OCT2009:00:00:00
|