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: 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!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 916 views
  • 0 likes
  • 3 in conversation