BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sg_kr
Obsidian | Level 7

Hi,

 

when i join the below tables

 

APC-19477289 obs

IOTC-1057 nobs

 

proc sql;
create table APC_1 as
select a.*, b.PROD_NAME
from APC as left join IOTC as b
on a.INS_OP_CODE =b.INS_OP_CODE and a.TYPE_COVERAGE_CODE=b.TYPE_COV_CODE;
quit;

 

i am getting the count of 36605480 obs in resultant dataset, i want APC count in my dataset.

 

could you please help

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

You have multiple matches for your key variable pairs in IOTC, causing a multiplication.

 

Do a

proc sort data=iotc out=test nodupkey;
by ins_op_code type_cov_code;
run;

and look at the log.

View solution in original post

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

Try this. In your posted code, you did not reference the table APC as a.

 

proc sql;
create table APC_1 as
select a.*, b.PROD_NAME
from APC as a left join IOTC as b
on a.INS_OP_CODE =b.INS_OP_CODE and a.TYPE_COVERAGE_CODE=b.TYPE_COV_CODE;
quit;
sg_kr
Obsidian | Level 7

sorry its typo error.

its referred as a in the code.

PeterClemmensen
Tourmaline | Level 20

Ok. Can you post your log please?

Kurt_Bremser
Super User

You have multiple matches for your key variable pairs in IOTC, causing a multiplication.

 

Do a

proc sort data=iotc out=test nodupkey;
by ins_op_code type_cov_code;
run;

and look at the log.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 834 views
  • 0 likes
  • 3 in conversation