BookmarkSubscribeRSS Feed
BrahmanandaRao
Lapis Lazuli | Level 10
title ' How to find Common variables in a Library';

data ds;
set sashelp.class;
run;

data ds1;
set sashelp.class;
run;



proc sql;
select * from dictionary.columns 
where libname='WORK'
and memname in ('DS', 'DS1')
group by upcase(Sex)
having count(*)>1;
quit;

 ERROR: The following columns were not found in the contributing tables: Sex.

2 REPLIES 2
ballardw
Super User

Dictionary.columns has no variable named SEX.

 

maybe you wanted

"and upcase(name)='SEX' "

on the where statement and then

 

group by Upcase(name)

 

or maybe completely ignoring the "memname in " part of the where if you are looking for the number of data sets that have "SEX" as a variable.

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

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
  • 2 replies
  • 683 views
  • 0 likes
  • 3 in conversation