I have three different datasets and I am trying to find same ID from the three datasets. I have used proc compare but, when using proc compare, you can only compare two datasets at a time. I was wondering if there is another way to compare the three data at the same time?
proc sql;
create table want as
select t1.id
from table1 t1, table2 t2, table3 t3
where t1.id = t2.id and t2.id = t3.id
;
quit;
So you want to find ID's that are present in all three datasets?
proc sql;
create table want as
select t1.id
from table1 t1, table2 t2, table3 t3
where t1.id = t2.id and t2.id = t3.id
;
quit;
Expand the where condition, if you need to check for combinations of id and date.
If you only need to check the date itself, run a separate select similar to the one for id.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.