You may have to fix my syntax here, but this approach should work:
proc sql;
create table matches as select a.*, b.id2 as matching_id2, b.id3 as matching_id3 from
have a, have b
where a.id1 ne b.id1 and (a.id1=b.id2 or a.id1=b.id3);
quit;
Can you post some sample data please.
You may have to fix my syntax here, but this approach should work:
proc sql;
create table matches as select a.*, b.id2 as matching_id2, b.id3 as matching_id3 from
have a, have b
where a.id1 ne b.id1 and (a.id1=b.id2 or a.id1=b.id3);
quit;
It looks like you dropped the word "FROM" within the SELECT statement.
The word HAVE (or HAVING) is supposed to represent the name of your data set. Most solutions that are posted here will use WANT as the name of the data set you want to obtain, and HAVE as the name of the data set you are starting with. So just replace that with the name of your data set.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.