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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 644 views
  • 0 likes
  • 2 in conversation