SAS Metadata Objects Details - SASLibraries, PhysicalTables, Jobs

拈花ヽ惹草 提交于 2019-12-13 02:53:54

问题


I've used this code to fetch the list of objects for all SAS Libraries, Physical Tables and Jobs. https://github.com/Boemska/macrocore/blob/master/meta/mm_getobjects.sas I now need to fetch these objects details, Like for Libraries - I need their libname and full path, Teradata Libs - Schema Name,Lib path Physical Tables - Location and other attribs Jobs - Location, and other attribs.

I'm not very familiar on how or what attribs can we report, but I definitely need their paths and attribs. Thank you.


回答1:


The example you refer to is using proc metadata that returns XML you need to understand and process. The real problem here is you have to learn how to build input XML to construct the metadata query, which is quite a complex thing.

Maybe more straight forward is to use Data step metadata functions like here.

METABROWSE command is useful to understand metadata object relations (if you have access to SAS Foundation), see here




回答2:


The attributes you are asking for will change depending on the library engine you are checking for.

The following macro will generate a libname for BASE, OLEDB, ODBC and POSTGRES engines:

https://github.com/Boemska/macrocore/blob/master/meta/mm_assigndirectlib.sas

The direct attributes are available as per this answer: How to get details of metadata objects in SAS

Folder path is available as per this answer:

%let metauri=OMSOBJ:PhysicalTable\A5HOSDWY.BE0006N9;
/* get metadata paths */
data ;
  length tree_path $500 tree_uri parent_uri parent_name $200;
  call missing(tree_path,tree_uri,parent_uri,parent_name);
  drop tree_uri parent_uri parent_name rc ;

  uri="&metauri";
  rc=metadata_getnasn(uri,"Trees",1,tree_uri);
  rc=metadata_getattr(tree_uri,"Name",tree_path);

  do while (metadata_getnasn(tree_uri,"ParentTree",1,parent_uri)>0);
    rc=metadata_getattr(parent_uri,"Name",parent_name);
    tree_path=strip(parent_name)||'/'||strip(tree_path);
    tree_uri=parent_uri;
  end;
  tree_path='/'||strip(tree_path);
run;


来源:https://stackoverflow.com/questions/56095004/sas-metadata-objects-details-saslibraries-physicaltables-jobs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!