问题
I'm wondering if anyone knows how to retrieve the sas folder path for metadata tables?
I would like to list the folder path for each tables located on metadata.
Example:
Table FactPortfolio is under the following fodler structure in management console: Commerc-->Sweden-->Portfolios-->Resources-->Tables
In metadata browser in sas, I can find the folder path if I click on tables and trees and parent trees until i reach the top hierarchy. However, I would like to retrieve it with metadata data step functions in SAS.
BR Jonas
回答1:
In Base you can use sashelp tables / dictionary views, e.g.
/* SQL Dictionary */ proc sql ; create table memlist as select * from dictionary.tables where libname='WORK' order by memname ; quit ; /* SASHELP */ data memlist ; set sashelp.vmember (where=(libname='WORK')) ; run ;
回答2:
This can be derived once you know the table URI, eg as follows:
%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;
Example code for getting table URI's can be found here and here.
来源:https://stackoverflow.com/questions/22477746/sas-folder-path-for-metadata-tables