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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1510 views
  • 0 likes
  • 3 in conversation