useR
useR

Reputation: 3082

SAS list and store all tables name under specify library to a table

Under library "testing", i have 5 datasets. How can i list all tables names?

proc datasets lib = work; quit; run;

While i would like to have further usage of the information. like the tables name.

Thanks

Upvotes: 2

Views: 28314

Answers (4)

Tammboy
Tammboy

Reputation: 331

More likely the user wants this solution which is quick and creates the table:

proc contents data=testing._ALL_;
ods output members=work.temp;
run;

Upvotes: 1

Jared
Jared

Reputation: 63

The answers above are correct but it can often take a long time to build the sashelp.vmember or dictionary.tables files. This will have better performance especially on the first run.

proc contents data=testing._all_;
  ods select members;
run;

Upvotes: 2

Narender
Narender

Reputation: 21

Proc sql;
     select *
     from sashelp.vmember
     where libname = "TESTING" 
  ;
quit; 

Make sure to put the library name in upper case.

Upvotes: 2

Chris J
Chris J

Reputation: 7779

Use the SQL dictionary.tables view...

proc sql ;
  create table mytables as
  select *
  from dictionary.tables
  where libname = 'WORK'
  order by memname ;
quit ;

Upvotes: 8

Related Questions