Reputation: 3082
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
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.
https://v8doc.sas.com/sashtml/proc/zsqldict.htm
Upvotes: 3
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