useR
useR

Reputation: 3082

list ALL library name in SAS LIBRARIES

I would like to search a sas data sets with name include "Loan".

If i know the specific library i can do it by proc datasets

proc datasets
    library = work
    memtype = data;
    contents
        data = _all_ (keep = libname memname name)
        out = work.table_name;
quit;
run;

(afterward i will select those memname contains "loan" using index function)

I would like to change the line library = work to library = _all_ While it file to access the library information. Is there any alternative way to achieve the task?

Upvotes: 3

Views: 8480

Answers (2)

in_user
in_user

Reputation: 1958

You could use "Dictionary" tables of SAS for this purpuse, you can search datasets name, column name etc

proc sql;
   create table mytable as
      select * from sashelp.vtable
      where upcase(memname) like '%LOAN%';
quit;

For example:-

 VCATALG Provides information about SAS catalogs.
 VCOLUMN Provides information about column in tables.
 VEXTFL Provides information related to external files.
 FORMATS Provides information related to defined formats and informats.
 VINDEX Provides information related to defined indexes.
 VMACRO Provides information related to any defined macros.
 VOPTION Provides information related to SAS system options.
 VTABLE Provides information related to currently defined tables.
 VTITLE Provides information related to currently defined titles and footnotes.
 VVIEW Provides information related to currently defined data views.

http://support.sas.com/documentation/cdl/en/lrcon/67885/HTML/default/viewer.htm#p00cato8pe46ein1bjcimkkx6hzd.htm

http://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#p00cato8pe46ein1bjcimkkx6hzd.htm

https://v8doc.sas.com/sashtml/proc/zsqldict.htm

Upvotes: 3

DomPazz
DomPazz

Reputation: 12465

Use the SASHELP.VTABLE view. It lists all tables in all libraries

proc sql noprint;
   create table search as
      select * from sashelp.vtable
         where upcase(memname) like '%LOAN%';
quit;

or

data search;
   set sashelp.vtable;
   if index(upcase(memname),'LOAN');
run;

Upvotes: 8

Related Questions