BookmarkSubscribeRSS Feed
Sandeep77
Lapis Lazuli | Level 10

Hello Experts,

I am trying to join Test_1 with Test_2 table with common client_code which is available in both the table but getting below error: 

 

NOTE: Writing HTML5(EGHTML) Body file: EGHTML
28
29 proc sql;
30 create table Test_2 as
31 select a.*,
32 b.cl_name,
33 b.client_code
34 from Test_1 as a
35 inner join p2scflow.client as b on a.client_code = b.client_code;
ERROR: Column client_code could not be found in the table/view identified with the correlation name A.
ERROR: Column client_code could not be found in the table/view identified with the correlation name A.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
36 quit;
NOTE: The SAS System stopped processing this step because of errors.

 

Not sure why it is throwing this error message. Can you please suggest what I am doing wrong here?

2 REPLIES 2
Kurt_Bremser
Super User

The message is clear: there is no variable named client_code in dataset work.test_1. Run a PROC CONTENTS on the dataset to see what it contains.

Also make sure that all preceding steps designed to create test_1 have run successfully (no ERRORs, WARNINGs or NOTEs beyond those that inform about CPU utilization and resulting dataset size).

ballardw
Super User

I'm going to make a small wager that if you have a "client code" variable in data set Test_1 that it is spelled differently. Possibly "clientcode" no underscore, or maybe "client__code" with two underscores or possibly and abbreviation like "clnt_code".

 

Especially if one or more of these data sets comes from something created by Proc Import or the wizards that use that procedure in the background variables names are subject to change on the whim of file creators.

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 372 views
  • 0 likes
  • 3 in conversation