Date: Wed, 27 Aug 2003 15:18:17 -0400
Reply-To: "Cacialli, Doug" <Doug_Cacialli@URMC.ROCHESTER.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Cacialli, Doug" <Doug_Cacialli@URMC.ROCHESTER.EDU>
Subject: Obtaining names of data sets contained within a library
Content-Type: text/plain
Hello everyone,
I'm working on a macro that requires I know the names of all data sets
contained within a specified library. The library of interest is being
created using the ODBC engine and libname statement. I'd like the user to
be able to simply specify the library name and then programmatically
determine what's inside. What I've currently got is this:
proc datasets library = somelib nolist;
contents data = somelib._all_ out = work.libcontent noprint;
run;
proc sql noprint;
select distinct libcontent.MEMNAME
into :SETLIST separated by ' '
from libcontent
where (substr(MEMNAME,1,3) ^= 'qry') and
(substr(MEMNAME,1,4) ^= 'MSys');
quit;
The 'where' sub-clause is necessary to eliminate any queries and other
assorted nonsense not actually generated from a table in my Access database.
The library name (e.g., 'somelib') and data set name (e.g., 'libcontent')
are actually macro parameters ... I've hard coded them here for convenience.
I'm wondering if anyone has a better (or different) way of easily obtaining
the contents of a library. Any input would be great. Thanks!
Doug out.
-------------------------------------------
Doug Cacialli - Data Manager / Data Analyst
Sleep and Depression Research Laboratory
University of Rochester Medical Center
300 Crittenden Boulevard - Box PSYCH
Rochester, New York 14642
Phone: (585)273-3309 Fax: (585)506-0287
-------------------------------------------