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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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