Date: Thu, 10 Jul 2003 08:36:30 -0400
Reply-To: Venky Chakravarthy <venky.chakravarthy@PFIZER.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Venky Chakravarthy <venky.chakravarthy@PFIZER.COM>
Subject: Re: Date problem
On Wed, 9 Jul 2003 15:19:05 -0500, tin-shun-jimmy chan <jimmy.chan@HEC.CA>
wrote:
>Hello,
>
>I have a problem with date in my dataset. In fact, I have kind of
>following observations (character format, we read it as day/month/year):
>
>9/1/1980
>10/1/1980
>11//1/1980
>14/01/80
>15/01/80
>1/2/1980
>2/2/1980
>3/2/1980
>
>Of course, the serie is much longer in my real dataset. I want to know
>how to convert it to a usable date observation because the date is
>important for my estimation.
>
>Any suggestion and help will be very appreciated.
>
>Thanks.
Assuming that the // is a typo and not representative of your data, the
DDMMYY date informat is what you are seeking. The absence of the century
marker for 2 of the date values does not matter. The YEARCUTOFF system
option will automatically detect that for you.
846 data _null_ ;
847 input mydate:ddmmyy. ;
848 list ;
849 put mydate = : date9. ;
850 cards ;
MYDATE=09JAN1980
851 9/1/1980
MYDATE=10JAN1980
852 10/1/1980
MYDATE=11JAN1980
853 11/1/1980
MYDATE=14JAN1980
854 14/01/80
MYDATE=15JAN1980
855 15/01/80
MYDATE=01FEB1980
856 1/2/1980
MYDATE=02FEB1980
857 2/2/1980
MYDATE=03FEB1980
858 3/2/1980
NOTE: DATA statement used:
real time 0.00 seconds
cpu time 0.00 seconds
859 run ;
Kind Regards,
Venky
|