Date: Fri, 9 Mar 2001 16:10:42 -0600
Reply-To: Anbu <aarumugam@STTHOMAS.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Anbu <aarumugam@STTHOMAS.EDU>
Subject: Re: Why DATEPART function is not working
Content-Type: text/plain; charset="iso-8859-1"
Re: Why DATEPART function is not workingIt worked. Thanks. But if I have value in worddate17 format like
Tue, Dec 2, 2003 How would I read. I tried many ways.
Help please.
Thanks
----- Original Message -----
From: Don & Susann
To: Anbu Arasu
Cc: SAS-L@LISTSERV.UGA.EDU
Sent: Sunday, March 07, 2004 1:41 AM
Subject: Re: Why DATEPART function is not working
Because X is not a datetime variable, it is a character string that has
the value
"'02DEC2003:00:00:00'dt"
That string literally is its value.
Its not clear from the example code what you are trying to do, but you
do not need to read the whole input datetime string if you only require
the datepart. Use
data dat ;
input @2 d date9. ;
put d= d= date9. ;
datalines;
02DEC2003:00:00:00
;
run;
Don
Anbu Arasu wrote:
> I tried extract datepart in the following program. But I could not. Why
> variable x is not equal to variable c.
> Thanks,
> Anbu
>
> data dat;
> input a $:20.;
> x= "'"||compress(a)||"'" || "dt";
> b=DATEPART('02DEC2003:00:00:00'dt);
> c='02DEC2003:00:00:00'dt;
> d=DATEPART(c);
> e=DATEPART(x);
> datalines;
> 02DEC2003:00:00:00
> ;
> run;
>
> proc print data=dat;
>
> run;
>
>
> output is
> a x b c d e
>
> 02DEC2003:00:00:00 '02DEC2003:00:00:00'dt 16041 1385942400 16041 .
>
>
--
Don Stanley, B.SC, Dip O.R.S, MNZCS
Author:: Beyond the obvious with SAS Screen Control Language.
Author:: Solutions for your GUI Applications Development Using SAS/AF
FRAME Technology
http://www.syswaregroup.com , http://homepages.rootsweb.com/~ashluke