I have written a macro to check for invalid dates and set it to '11111111', but got an unexpected NOTE: Invalid argument to function INPUT. The reason for the note is, source data has date "0212-04-26" which is beyond the SAS dates ranging A.D. 1582 to A.D. 19,900. So now I'm looking to check for invalid date without any message`.
My Code:
%macro chkdate(datefld=, num_date=) ;
/* invalid date gets set to '11111111' */
if &datefld ne '0001-01-01' then do ;
t_date = input(compress(&datefld, '-'), yymmdd8.) ;
if t_date eq . then do ;
%errors( key_desc=Invalid Date, fname=&datefld,)
&datefld = '11111111' ;
end;
end;
%mend chkdate ;
thanks
num_date=argument is not used anywhere in the macro... - Dominic Comtois