Date: Thu, 8 Nov 2001 11:09:51 -0500
Reply-To: Laurel Copeland <lacop@UMICH.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Laurel Copeland <lacop@UMICH.EDU>
Subject: Re: Need help with invalid dates
In-Reply-To: <200111081545.KAA20454@kingcreole.mr.itd.umich.edu>
Content-Type: text/plain; charset="us-ascii"; format=flowed
SAS has formats like yymmdd8. for numerics that come into the dataset like
yours:
20000428
19990201
(also mmddyy8. for 01311956 and so on)
i believe that SAS, when told to expect a date and given something like
yyyy0431 will make it missing data.
try with small ds?
data x;
input numdat;
cards;
20000401
19990201
20010431
19990229
;
run;
data y; set x;
date=input(left(numdat),yymmdd8.);
format date date9.;
run;
proc print; run;
/*
Obs numdat date
1 20000401 01APR2000
2 19990201 01FEB1999
3 20010431 .
4 19990229 .
*/
hth, laurel
At 05:53 AM 11/8/01 +0000, Jim-N-Tx wrote:
>I have a data step that will be reading dates in PD5. format - some of these
>dates are invalid (yyyy0431 and yyyy0229 for non-leap year) - not sure if
>there's a way to have SAS correct these dates - any ideas? If not I'm
>willing to live with it, I just need to know how to print them in MM-DD-YY
>format. I've tried several variations of format/put statements but just
>can't seem to get the right combination. Thanks for your help.
>Jim
|