blidt
blidt

Reputation: 129

SAS intersect with date values

I have two tables, one that was created using a connection to teradata and other one that was created importing an excel file.

I need to find the records that are on one table but not on the other given three of the fields. The first two are returning what i would expect but when i add the third field which is a date field then none of the records match. Wen i look into the tables i see that the two dates are identical but somehow SAS does not consider them to be identical.

My code looks like this:

PROC SQL;
    CREATE TABLE fields_that_do_not_match AS
        SELECT /*FIRST TWO FIELDS*/ date_a  FROM table_a
            EXCEPT
        SELECT /*FIRST TWO FIELDS*/ date_b FROM table_b;
QUIT;

Is there something else i should be considering for comparing dates? When i see the properties of the date fields both are on DATE9. format, are of numerical type and have 8 bytes in length. Both of the dates show 14FEB2022 when i query the table but i don't know if some of the tables have aditional information that is not being displayed due to the format.

Thanks in advance.

Upvotes: 0

Views: 233

Answers (1)

blidt
blidt

Reputation: 129

The reason why the dates did not match was because one of them had decimal values and i needed to round the values. I added INT(DATE_A) and it worked after that.

Upvotes: 1

Related Questions