BookmarkSubscribeRSS Feed
LanMin
Fluorite | Level 6

Dear all,

I use the code below to do a left out join and keep getting error message.

PROC SQL;

CREATE TABLE LEFT_OUTER_JOIN AS

SELECT *

FROM use(KEEP=IndIO ComIO ProducerPr PurchaserPr)

LEFT JOIN

Make (KEEP=IndOut)

ON use.IndIO = make.IndIO;

run;

ERROR: Column IndIO could not be found in the table/view identified with the correlation name

       MAKE.

ERROR: Column IndIO could not be found in the table/view identified with the correlation name

       MAKE

My use and make data are sas dataset. IndIo is Best $6, and Best $7. I wonder if this information difference is causng the error.

thanks and happy holidays,

Lan

7 REPLIES 7
art297
Opal | Level 21

With make you are only keeping IndOut, but then trying to use make.IndIO

LanMin
Fluorite | Level 6

Thanks Arthur!

I made the change

PROC SQL;

CREATE TABLE LEFT_OUTER_JOIN AS

SELECT *

FROM use(KEEP=IndIO ComIO ProducerPr PurchaserPr)

LEFT JOIN

Make (KEEP=IndIO IndOut)

ON use.IndIO = make.IndIO;

run;

and got  740119 rows, but is greater than the number of observations in both datasets,

Lan

Peter_C
Rhodochrosite | Level 12

Repeatsof the join key on either table

art297
Opal | Level 21

And, actually, I'm surprised you got so few.  When I ran your code I got: 847,103

Also, replace the "run" statement with a "quit" statement.

LanMin
Fluorite | Level 6

Thank you , Arther.

Tom
Super User Tom
Super User

You have multiple records for the same value of the key (IndIO) in the RIGHT table (Make).  So if in the table MAKE there are 10 records with the same value of INDIO then every record from the LEFT table (use) with that value of INDIO will be replicated 10 time.

You might want to add the DISTINCT keyword after the SELECT keyword.

LanMin
Fluorite | Level 6

Thank you ,  Tom.

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