Reputation: 21
I would like to create a new table with all tables contained within a library and the variables within each of those tables. I know I can use something like the below to get the table name but I cant find much on getting each variable. I have multiple libraries and each has potentially hundreds of tables. Any help really appreciated.
proc sql ;
create table mytables as
select *
from dictionary.tables
where libname IN ('WORK','SPDSWORK',etc)
order by memname ;
quit ;
Upvotes: 0
Views: 1702
Reputation: 51621
Just use PROC CONTENTS with the special _ALL_ member name. Use the NOPRINT option to suppress the output and the OUT= option to name the dataset with the contents information.
proc contents data=mylib._all_ noprint out=contents;
run;
Upvotes: 5
Reputation: 4937
Use distionary.columns instead.
proc sql ;
create table mytables as
select *
from dictionary.columns
where libname IN ('SASHELP')
order by memname ;
quit ;
Upvotes: 4