I have the following 3 proc sqls and trying to figure out how to make them just 1. The reason for this is I have a total of proc1 through proc20. I need to compared proc1 in main table to proc1 in second table. then proc2 in main table to proc2 in second table. then proc1 in main table to proc1 in second table and proc3 in main table to proc2 in second table. And so on.
proc sql;
create table p1 as
(select a.*,
from
phyclms a
inner join c0 b
on a.proc1=b.proc1 and a.proc2=b.proc2
group by a.clm_aud_nbr);
quit;
proc sql;
create table p2 as
(select a.*,
from
phyclms a
inner join c0 b
on a.proc1=b.proc1 and a.proc3=b.proc2
group by a.clm_aud_nbr);
quit;
proc sql;
create table p3 as
(select a.*,
from
phyclms a
inner join c0 b
on a.proc1=b.proc1 and a.proc3=b.proc2
group by a.clm_aud_nbr);
quit;
I don't really understand what you are trying to accomplish. Your description of the problem is somewhat unclear. In addition, your 2nd and 3rd PROC SQL statements appear to be identical.
In any case, have you considered using a series of LEFT joins instead of INNER joins?
Let me put together a data have. Might make better sense.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.