As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Getting list of ODS tables

From sasCommunity
Jump to: navigation, search

Q: How do I get a list all the ODS tables?

M. Howard

to SAS-L 2009-Jan-07

PROC Template;
              path   sashelp.tmplmst;
              list / descending
              sort = path ;


Path Filter is: *

Obs   Path                                                            Type
---   -------------                                                   ------ 
1     Tagsets.Xhtml                                                   Tagset
2     Tagsets.Xbrl                                                    Tagset
4970  Base.Catalog.Random                                             Table
4971  Base.Catalog                                                    Dir
4972  Base                                                            Dir

J. Cartier


I guess you know about the ODSTEMPLATE command (short form ODST) which opens the Templates Window in Display Manager. If you haven't used it, it is a very handy way to view all SAS-defined and user-defined templates as a tree view.

Mary showed the basic way to get the available metadata for any ODS item store programmatically. There is other metadata available (such as creation date, etc. that is not very useful). I think the only additionally metadata item that is helpful is the template LABEL. Here I created a permanent dataset with the metadata (the metadata for SASHELP templates won't change until you install the next release).

ods listing close;
ods output stats=sasuser.templates;
proc template;
 path sashelp.tmplmst;
 list / sort=path stats=label;
ods listing;

If you look at the doc for PROC TEMPLATE, you will see that there are many different supported template types, some of which you are probably not of interest to you. So you could filter the metadata to those template types that are just "Table" (or those related to tables such as "Column" or "Link"):

data sasuser.tableTemplates;
 length Product $20;
 set sasuser.templates;
 where type in ("Table");

Lastly if you wanted to find what columns a table template uses, you could do something like this:

proc template;
path sashelp.tmplmst;
source  Base.Univariate.Quantiles / file="c:\temp\tplsource.txt";

data _null_;
infile "c:\temp\tplsource.txt";
if upcase(scan(_infile_,1,"; ")) eq "COLUMN" then
  put _infile_;

This will dump the column statement in the template.