I am looking to develop a macro so that that macro can pull out the list of libraries details from a server along with the memtype information.
For example I am working on SASApp Server and the server has 50 libraries, in these libraries each library contains 50 to 60 tables so I need to pull out all the information about the libraries and tables along with the libref, path and schema details.
Eventually we can use Proc contents data=libref._all_ out=dataset name; run;
The problem here is every time I have to give the libref name to pull out the information about a paticular library. I need the program should itself assign the libref and populate information about the list of libraries and memtype details.
Is this UNIX or Windows or anything else? It looks like you will need to either embed your SAS code within the native environment's programming language or the other way around. In UNIX, this can be achieved using shell scripting and some SAS; for other environments, we will have to check. Either way, some more details might help.
Are you able to get an automated list of the folders you would like to report on? If so, the rest is nearly easy. If not, how would SAS know which folders to examine? You wouldn't want to examine every folder on the system. You wouldn't even want to use the metadata from SASHELP unless you are willing to hardcode the exceptions like WORK, MAPS, etc.
If you see the information you need then you could use the Dictionary tables with proc sql.
From the online help:
proc sql; describe table dictionary.tables;
NOTE: SQL table DICTIONARY.TABLES was created like: create table DICTIONARY.TABLES ( libname char(8) label='Library Name', memname char(32) label='Member Name', memtype char(8) label='Member Type', dbms_memtype char(32) label='DBMS Member Type', memlabel char(256) label='Data Set Label', typemem char(8) label='Data Set Type', crdate num format=DATETIME informat=DATETIME label='Date Created', modate num format=DATETIME informat=DATETIME label='Date Modified', nobs num label='Number of Physical Observations', obslen num label='Observation Length', nvar num label='Number of Variables', protect char(3) label='Type of Password Protection', compress char(8) label='Compression Routine', encrypt char(8) label='Encryption', npage num label='Number of Pages', filesize num label='Size of File', pcompress num label='Percent Compression', reuse char(3) label='Reuse Space', bufsize num label='Bufsize', delobs num label='Number of Deleted Observations', nlobs num label='Number of Logical Observations', maxvar num label='Longest variable name', maxlabel num label='Longest label', maxgen num label='Maximum number of generations', gen num label='Generation number', attr char(3) label='Data Set Attributes', indxtype char(9) label='Type of Indexes', datarep char(32) label='Data Representation', sortname char(8) label='Name of Collating Sequence', sorttype char(4) label='Sorting Type', sortchar char(8) label='Charset Sorted By', reqvector char(24) format=$HEX48 informat=$HEX48 label='Requirements Vector', datarepname char(170) label='Data Representation Name', encoding char(256) label='Data Encoding', audit char(8) label='Audit Trail Active?', audit_before char(8) label='Audit Before Image?', audit_admin char(8) label='Audit Admin Image?', audit_error char(8) label='Audit Error Image?', audit_data char(8) label='Audit Data Image?', num_character num label='Number of Character Variables', num_numeric num label='Number of Numeric Variables' );
proc sql; describe view sashelp.vtable;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.