works for our instance: name libref engine path mdschemaname schema MDMUP07 MDMUP07 ORACLE MDMUP07 MDM RevLib3 REVLIB3 BASE //sasuser/MichaelC/MCLib/RevLib3 StarLMK STARLMK BASE //sasuser/MichaelC/MCLib/StarLMK Cubelib CUBELIB BASE //sasuser/Biju/Cubelib ChnGrw CHNGRW BASE //sasuser/MichaelC/MCLib/ChnGrw RRRLib RRRLIB BASE //sasuser/MichaelC/MCLib/RRRLib TMDM TMDM ORACLE TMDM MDM RevLib2 REVLIB2 BASE //sasuser/MichaelC/MCLib/RevLib2 SASApp1 - SASDATA SASDATA BASE Data RCLIB RCLIB BASE //sasuser/Rachel CardAso CARDASO BASE //sasuser/MichaelC/MCLib/CardAso RevLib REVLIB BASE //sasuser/MichaelC/MCLib/RevLib CCLIB CCLIB BASE //sasuser/MichaelC/MCLib/CCLib VCCLib VCCLIB BASE //sasuser/MichaelC/MCLib/VCCLib CORP_RPT CORP_RPT SQLSVR CORP_RPT DBO scraped from sas support: options metaserver="metadataserver" metaport=8561 metauser="admin user" metapass="admin pw" metarepository="Foundation"; data metadata_libraries; length liburi upasnuri $256 name $128 type id $17 libref engine $8 path mdschemaname schema $256; keep name libref engine path mdschemaname schema; call missing(liburi,upasnuri,name,engine,libref); nlibobj=1; librc=metadata_getnobj("omsobj:SASLibrary?@Id contains '.'",nlibobj,liburi); do while (librc>0); /* Get Library attributes */ rc=metadata_getattr(liburi,'Name',name); rc=metadata_getattr(liburi,'Engine',engine); rc=metadata_getattr(liburi,'Libref',libref); /* The METADATA_GETNASN function specifies to get objects associated to the library via the UsingPackages association. The n argument specifies to return the first associated object for that association type. upasnuri is an output variable. It will store the URI of the associated metadata object, if one is found. */ n=1; uprc=metadata_getnasn(liburi,'UsingPackages',n,upasnuri); /* When a UsingPackages association is found, the METADATA_RESOLVE function is called to resolve the URI to an object on the metadata server. The CALL MISSING routine assigns missing values to output variables. */ if uprc > 0 then do; call missing(type,id,path,mdschemaname,schema); rc=metadata_resolve(upasnuri,type,id); /* If type='Directory', the METADATA_GETATTR function is used to get its path and output the record */ if type='Directory' then do; rc=metadata_getattr(upasnuri,'DirectoryName',path); output; end; /* If type='DatabaseSchema', the METADATA_GETATTR function is used to get the name and schema, and output the record */ else if type='DatabaseSchema' then do; rc=metadata_getattr(upasnuri,'Name',mdschemaname); rc=metadata_getattr(upasnuri,'SchemaName',schema); output; end; /* Check to see if there are any more Directory objects */ n+1; uprc=metadata_getnasn(liburi,'UsingPackages',n,upasnuri); end; /* if uprc > 0 */ /* Look for another library */ nlibobj+1; librc=metadata_getnobj("omsobj:SASLibrary?@Id contains '.'",nlibobj,liburi); end; /* do while (librc>0) */ run; /* Print the metadata_libraries data set */ proc print data=metadata_libraries; run;
... View more