Lee R Liddick Jr
asked on
Two Table Compare
I am needing to compare two tables in SAS (using SQL sytax) to find out what records in Table A is in Table B, and if they are not in Table B, then I want to add a column to the query to mark them as 'New'.
PROC SQL;
create table TableC as
select a.*, 'New' as Type
from TableA a
where a.id not in (select id from TableB);
QUIT;
Obviously my query is currently only getting those records that don't match and creating the new column...but there has to be a way to do this all in one query, or maybe I'm wrong.
PROC SQL;
create table TableC as
select a.*, 'New' as Type
from TableA a
where a.id not in (select id from TableB);
QUIT;
Obviously my query is currently only getting those records that don't match and creating the new column...but there has to be a way to do this all in one query, or maybe I'm wrong.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.