Date: Tue, 19 Aug 2008 03:26:33 -0700
Reply-To: Sandip <sandiptoton@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Sandip <sandiptoton@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: how to convert char variables into a date format?
Content-Type: text/plain; charset=ISO-8859-1
On Aug 19, 11:23 am, n <nikhil.abhyan...@gmail.com> wrote:
> On Aug 19, 11:19 am, n <nikhil.abhyan...@gmail.com> wrote:
>
> > Hi all;
>
> > I have a char9 variable which actually holds dates like, 09-Apr-07.
>
> > I get an error, The informat $DATE was not found or could not be
> > loaded. when I try using,
>
> > data want; set have;
> > informat date DATE7. ;
> > run;
>
> > Could anybody please tell me what is going wrong and how could I
> > change the informat of the char type variable to a date informat?
>
> I had tried removing the informat by,
>
> data want;
> set have;
> informat date;
> run;
>
> However, even this doesn't seem to work. The proc content still shows
> that date is a char 9 variable.
Hi,
You can use date11 format for the convertion.
data a;
input date $9.;
cards;
09-Apr-07
09-Apr-08
;
data b;
set a;
sasdate=input(date,date11.);
format sasdate ddmmyy6.;
run;
Regards,
Sandip
|