Desktop productivity for business analysts and programmers

ERROR: The following columns were not found in the contributing tables: KLF, KNS, KSOZ with proc sql

Reply
New Contributor
Posts: 4

ERROR: The following columns were not found in the contributing tables: KLF, KNS, KSOZ with proc sql

I have a data set and I just want to do:

 

 

proc sql;
create table tmp_ivk as
select
KSOZ,
KNS,
KBTYP,
KLF,
count(*) as N 'N'
from db.grundgesamtheit&jahr1
group by KSOZ,
KNS,
KBTYP,
KLF
order by KSOZ,
KNS,
KBTYP,
KLF
;
quit;

 

but I get constantly the ERROR message for the second data base.

 

I also have an another data set and I did the same proc sql and it worked perfectly.

Respected Advisor
Posts: 3,275

Re: ERROR: The following columns were not found in the contributing tables: KLF, KNS, KSOZ with proc

[ Edited ]
Posted in reply to LucianTUM

The error message is perfectly clear:

 

The following columns were not found in the contributing tables: KLF, KNS, KSOZ with proc sql

 

Since we don't have your data sets, you need to go into the datasets and determine what variables are there and what variables are missing and adjust your SQL accordingly.

 

--
Paige Miller
New Contributor
Posts: 4

Re: ERROR: The following columns were not found in the contributing tables: KLF, KNS, KSOZ with proc

Posted in reply to PaigeMiller

Of course is the message clear. I had a look on the dataset and the mentioned variables were present.

Super User
Posts: 10,571

Re: ERROR: The following columns were not found in the contributing tables: KLF, KNS, KSOZ with proc

Posted in reply to LucianTUM

When SAS tells you that a variable is not there, it isn't there, period.

Post the log of your code (complete step!), and the part of a proc contents output for all the contributing datasets that shows the variables.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Super User
Posts: 8,216

Re: ERROR: The following columns were not found in the contributing tables: KLF, KNS, KSOZ with proc

Posted in reply to LucianTUM

You haven't shown what error message you're getting. That would definitely help to identify what problem your facing.

 

Looking at your code, a number of possibilities exist. Have you assigned the libname db?, Have you assigned the macro variable jahr1 AND is it part of the actual filename?, and Do all of those variables exist in your datafile?

 

Art, CEO, AnalystFinder.com

 

New Contributor
Posts: 4

Re: ERROR: The following columns were not found in the contributing tables: KLF, KNS, KSOZ with proc

Solved! Thank you!

Respected Advisor
Posts: 3,275

Re: ERROR: The following columns were not found in the contributing tables: KLF, KNS, KSOZ with proc

Posted in reply to LucianTUM

LucianTUM wrote:

Of course is the message clear. I had a look on the dataset and the mentioned variables were present.


And yet you expect us to diagnose the problem, but you provide no information at all. We can't look at your datasets. You have all the information. As others have said, show us the SASLOG and PROC CONTENTS.

--
Paige Miller
New Contributor
Posts: 4

Re: ERROR: The following columns were not found in the contributing tables: KLF, KNS, KSOZ with proc

Posted in reply to PaigeMiller

I am just a beginner. But, thank you!

Ask a Question
Discussion stats
  • 7 replies
  • 353 views
  • 1 like
  • 4 in conversation