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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.