Hi Cosmid, sorry, I was possibly a little unclear. In order to specify a date using that methodology, you have to specify the check as '01JAN1988'd for instance, as opposed to '01/01/1998'd.
The actual SAS date field you are comparing it to can be in any format you like.
Formats in SAS do not affect the data held in the field. In this case, the data itself is a number which is a count of the number of days since 01 January 1960. Whatever format you apply to that field, the underlying data will not change.
Here's a little test code for you:-
Code:
data _null_;
date1 = '01JAN1960'd;
date2 = '28DEC1959'd;
date3 = '27OCT2008'd;
date4 = '28OCT2008'd;
put date1=;
put date2=;
put date3=;
put date4=;
run;
As you can see, a date prior to 01JAN1960 gives a negative number.
Now, with formats:-
Code:
data _null_;
date1 = '01JAN1960'd;
date2 = '28DEC1959'd;
date3 = '27OCT2008'd;
date4 = '28OCT2008'd;
put date1=;
put date2=;
put date3=;
put date4=;
format date1 date2 ddmmyy10. date3 date4 date9.;
run;
data _null_;
date1 = '01JAN1960'd;
date2 = '28DEC1959'd;
date3 = '27OCT2008'd;
date4 = '28OCT2008'd;
put date1=;
put date2=;
put date3=;
put date4=;
format date1 date2 ddmmyy10. date3 date4 date9.;
run;
Ordinarily, I would put the format statement first as this is generally accepted I believe as best practice. However I wanted to demonstrate something here. FORMAT is a "non-executable" statement, it doesn't need to be compiled to run, therefore it is processed BEFORE anything else in the step runs, so even though it appears AFTER the put statements, it is actually processed BEFORE them.
I hope this helps.
Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.