Link to home
Start Free TrialLog in
Avatar of morinia
moriniaFlag for United States of America

asked on

Compa;ring two dates in SAS

I have two dates in SAS.  Both are defined as:
 Num       8    DATE9.    DATE9

Both dates contain  02AUG2011

What is the syntax to compare DATEA to DATEB.  They are not comparing as equal.

I am trying to use this statement:

proc sql undo_policy=none;
        create table C as
        select                           a.mbr_id
            , a.date
            , b.date
            from filea a left join fileb b      
                           on a.mbr_id=bmbr_id      
                            and a.date= b.date;
quit;
Avatar of Aloysius Low
Aloysius Low
Flag of Singapore image

what's the error you are getting?

if you had copied the code and pasted into the question, then it appears that there's a problem with your code: a.mbr_id=bmbr_id <- shouldn't it be b.mbr_id?

assuming that it is a genuine typo, then might be worthwhile looking at the actual value stored in the table...
Avatar of morinia

ASKER

It was a typo.

Even if I use a dat step the two dates do not compare equal and the data in both fields has the same description in a proc contents and the data in the date field is the same.

02AUG2011
ASKER CERTIFIED SOLUTION
Avatar of Aloysius Low
Aloysius Low
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of morinia

ASKER

You are correct.  The values I thought were equal actually have

18841 for the first date  and  18841.4492 on the second date