Date: Tue, 11 Apr 2006 12:58:19 -0400
Reply-To: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject: Re: DATE HELP
Ran
I agree with Toby: that is no good idea and it's not possible in SAS. You
have a strict definition of SAS date values, which are the difference in
days to the 01jan1960 (in certain limits). Also it is not rue, that nothing
happens with your call of MDY:
13 data a;
14 x=mdy(99,99,9999);
15 run;
NOTE: Invalid argument to function MDY at line 14 column 5.
x=. _ERROR_=1 _N_=1
Ok, the result is the same, x remains a missing, but the reason is a error
in the function call.
If you simply try to get it for display, you should try to convert your date
to string and assign your desired string to the variable if you think the
date is invalid. That might be something different to missing, e.g you have
a birth-date of a person and its > than today(). It might be a non missing
(valid) SAS date, but for your logic it's invalid. In that case I'd prefer
something like "invalid date" or "birthdate in future". Or think of
"01jan20000"d - a valid SAS date, maybe for you a typo...
On Tue, 11 Apr 2006 14:38:41 +0000, toby dunn <tobydunn@HOTMAIL.COM> wrote:
>Ran ,
>
>First off you dont really want to do this. This is an old DB and Cobol
>trick that should be banned forever and those doing it beat within an inch
>of their life. For the simple fact that you introduce so much misleading
>and bad information into your data.
>
>Now 99/99/9999 is not a valid SAS Date value. And 12/04/2020 is a valid SAS
>Date Value.
>
>What I think you are after is all Data that is missing or outside of a
>specified range you want coded a certain way. Since SAS Date Values are
>numeric and SAS has special missing value for numeric I would use those.
>
>So test for intial missing values and code those as .A and all value that
>are valid but fall outside of your range code as .B . Now when stats are
>run on this variable they will be treated as missing but when you need to do
>some analysis work to dig deeped into these values you will get results that
>you can you such as 10% of the values are valid but fall outside of the
>exceptable range of values while 5% had missing date values.
>
>
>
>Toby Dunn
>
>
>
>
>
>From: Ran S <raan67@YAHOO.COM>
>Reply-To: Ran S <raan67@YAHOO.COM>
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: DATE HELP
>Date: Tue, 11 Apr 2006 10:23:10 -0400
>
>Hi,
>
>I have DOB field. I just want to replace the missing dates to 99/99/9999.
>Here DOB is a numeric field and when I using following codes nothing is
>happening:
>IF DOB=. THEN DOB=MDY(99,99,9999);
>if DOB=MDY(12,04,2020) then DOB=MDY(99,99,9999); *Invlaid date;
>
>How can I replace the missing or invlaid dob to 99/99/9999?
>
>I would appreciate your help.
>Thanks!
|