BookmarkSubscribeRSS Feed
figureItOut
Fluorite | Level 6

Hello,

I found some SAS code that retrieves all of the libraries and some of their associated SAS metadata.  I would like to expand this code to retrieve each library's table metadata.  It seems like for each library a loop is needed to find the number of tables in the library, then for each table retrieve the description, the folder and so forth.

Any suggestions?

Thank you.

6 REPLIES 6
Reeza
Super User
Quick check - you've looked at sashelp.vtable and sashelp.vcolumn views?
figureItOut
Fluorite | Level 6
Thanks Reeza but the sashelp.vtable and sashelp.vcolum (and associated dictionaries) do not contain SAS metadata info. 
ballardw
Super User

JOIN between the appropriate tables should work in SQL instead of looping.

 

One question is which "table metadata" that you want.

figureItOut
Fluorite | Level 6

The table metadata I want, to start with, is the Name, Description, Location, and actual physical table name.  As shown in SAS Management Console.  CommunitiesPost1a.pngCommunitiesPost1b.png

SASKiwi
PROC Star

Try this:

proc sql;
  create table Tables as
  select  T.libname
         ,T.memname
         ,T.memlabel
		 ,L.path
		 ,L.sysdesc
  from dictionary.tables as T,
       dictionary.libnames as L
  where upcase(memname) = 'ODSSTYLE'
  and T.libname = 'STPSAMP' 
  and T.libname = L.libname
  ;
quit;
Patrick
Opal | Level 21

@Reeza , @SASKiwi , @ballardw 

I believe the code and screenshot the OP shared makes it obvious that this is about querying SAS metadata and SAS Metadata Tables and not the SAS dictionary.

@figureItOut : Yes, you would need to implement some sort of loop logic per metadata library definition. I haven't checked but would assume tables are associations for libraries. 

 

I normally use the SAS Windows Manager and then metabrowse to figure out how things "hang together" in SAS Metadata. 

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1701 views
  • 2 likes
  • 5 in conversation