Date: Mon, 5 Oct 2009 19:51:20 -0500
Reply-To: Kevin Myers <KevinMyers@AUSTIN.RR.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Kevin Myers <KevinMyers@AUSTIN.RR.COM>
Subject: Re: Special Date Informat
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original
Your use of the max functions is nice. I always like shorter code.
However, this approach suffers from the same basic problem as the other
suggestions that I received, in that it requires an assignment statement
while I had hoped to avoid changing the code generator to do anything other
than writing attribute statements and an input statement. In the end I had
to give up and change the code generator to write assignment statements for
these variables anyway.
Thanks anyway for the suggestion.
s/KAM
----- Original Message -----
From: "-bwg" <barry.grau@GMAIL.COM>
To: <SAS-L@LISTSERV.UGA.EDU>
Sent: Monday, October 05, 2009 09:56
Subject: Re: Special Date Informat
> How about this?
>
> data foo;
> infile cards dlm="-" missover;
> input @":" _y _m _d;
> mdy=mdy(max(_m, 1), max(_d, 1), _y);
> put _all_/;
>
> format mdy yymmdd10.;
> drop _:;
> cards;
> Normal date: 2009-09-30
> Unknown day: 2009-09-00
> Unknown month: 2009-00-00
> ;
>
> On Sep 30, 7:48 pm, kmye...@CLEARWIRE.NET (Kevin Myers) wrote:
>> I am rusty at creating custom informats, and hoping that someone else =
>> out there will know the answer to this right away...
>>
>> Using SAS 8.2, I want to read some date values that mostly conform to =
>> the informat yymmdd10. However, when the specific day or month =
>> corresponding to these date values were unknown, they have been input as
>> =
>> 00. For example:
>>
>> Normal date: 2009-09-30
>> Unknown day: 2009-09-00
>> Unknown month: 2009-00-00
>>
>> I need to convert all of these values to SAS dates, and for my purposes,
>> =
>> unknown day and month values can each be treated as 01. So the SAS =
>> dates values that I want for the preceding values would correspond to:
>>
>> Normal date: 2009-09-30
>> Unknown day: 2009-09-01
>> Unknown month: 2009-01-01
>>
>> Does anyone out there know how to create an informat that will produce =
>> this result?
>>
>> Thanks,
>> Kevin M.
>
|