Avatar of morinia
morinia
Flag 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;
Databases

Avatar of undefined
Last Comment
morinia

8/22/2022 - Mon
Aloysius Low

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...
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
Aloysius Low

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
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
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck