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.
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.
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!
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.