BookmarkSubscribeRSS Feed
LucianTUM
Calcite | Level 5

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.

7 REPLIES 7
PaigeMiller
Diamond | Level 26

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
LucianTUM
Calcite | Level 5

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

Kurt_Bremser
Super User

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.

art297
Opal | Level 21

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

 

PaigeMiller
Diamond | Level 26

@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

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

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 4108 views
  • 1 like
  • 4 in conversation