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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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