BookmarkSubscribeRSS Feed
tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

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.*,

  1. b.proc1 as tbl1_proc1,
  2. b.proc2 as tbl1_proc2,
  3. b.edit

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.*,

  1. b.proc1 as tbl1_proc1,
  2. b.proc2 as tbl1_proc2,
  3. b.edit

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.*,

  1. b.proc1 as tbl1_proc1,
  2. b.proc2 as tbl1_proc2,
  3. b.edit

from

phyclms a

inner join c0 b

on a.proc1=b.proc1 and a.proc3=b.proc2

group by a.clm_aud_nbr);

quit;

2 REPLIES 2
Fugue
Quartz | Level 8

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?

tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

Let me put together a data have. Might make better sense.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 792 views
  • 0 likes
  • 2 in conversation