DATA Step, Macro, Functions and more

retrieve information for metadata tables

New Contributor
Posts: 2

retrieve information for metadata tables

Hi All!


I am working on retrieving a list of tables and related information(e.g. source table) that were registered in Metadata.

I tried to use %mdsecds() to make this come true, but the related information is not enough to meet my requirements.

Is there any methods to locate where the metadata tables originally come from, but not the location in the SAS folder?

Thank you for your attention. I really appreciate any help you can provide.


Super Contributor
Posts: 500

Re: retrieve information for metadata tables

The metabrowse-utility - found in display manager - is useful to see what's stored in metadata at all. You could use the metadata-functions to extract the information. I don't have an example at hand, but you will find code explaining how to get user-data from metadata with those functions, you will have to adept object names etc.


Respected Advisor
Posts: 4,571

Re: retrieve information for metadata tables


You can query metadata using SAS code - but it can become involved. If you look into the actual code of the %mdsec macro then you might get the idea.


For what's missing: Can you please be more specific? What is it exactly that %mdsec doesn't give you?

New Contributor
Posts: 2

Re: retrieve information for metadata tables



Sorry for my unclear expression.

The missing data is the original location(library) of the metadata tables before they are registered.
For example: Suppose a table named【Demo】, stored in a pre-assigned sas library【LIB】, were registered in a sas folder【Shared folder】. Although %mdsec macro can give me a location of the sas folder【Shared folder 】, what I need is the original location【LIB】 of the table.

Is there any sas code to extract that kind of data?



Super User
Posts: 9,612

Re: retrieve information for metadata tables

Are you actually looking for the result of the pathname() function?

Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Posts: 806

Re: retrieve information for metadata tables

If you have the name of a table within the metadata like: "/folder/subfolder/tablename(Table)" there is a macro as described in to read out the name as libref.tableName

Ask a Question
Discussion stats
  • 5 replies
  • 5 in conversation