[英]SAS Metadata Objects Details - SASLibraries, PhysicalTables, Jobs
[英]How to get details of metadata objects in SAS
我有一個來自我的存儲庫的元數據對象列表。 我已經獲取了所有 SASLibrary、PhysicalTable、Jobs 對象。 現在我需要獲取他們的所有詳細信息。 有人可以建議我怎么做嗎? 我是 SAS DI 的新手,需要使用 SAS 代碼獲取詳細信息。 謝謝
好的,假設您有一個包含這些對象的數據集 ( have
),並且 uri 存儲在名為uri
的變量中,那么以下內容就足夠了:
data associations;
keep assoc assocuri name;
length assoc assocuri name $256;
set have;
rc1=1;n1=1;
do while(rc1>0);
/* Walk through all possible associations of this object. */
rc1=metadata_getnasl(uri,n1,assoc);
rc2=1;n2=1;
do while(rc2>0);
/* Walk through all the associations on this machine object. */
rc2=metadata_getnasn(uri,trim(assoc),n2,assocuri);
if (rc2>0) then do;
rc3=metadata_getattr(assocuri,"Name",name);
output;
end;
call missing(name,assocuri);
put arc= rc2=;
n2+1;
end;
n1+1;
end;
run;
proc sort data=associations;
by assoc name;
run;
proc sql;
create table groupassoc as
select assoc, count(*) as cnt
from associations
group by 1;
data attrprop;
keep type name value;
length type $4 name $256 value $32767;
set have;
rc1=1;n1=1;type='Prop';
do while(rc1>0);
rc1=metadata_getnprp(uri,n1,name,value);
if rc1>0 then output;
n1+1;
end;
rc1=1;n1=1;type='Attr';
do while(rc1>0);
rc1=metadata_getnatr(uri,n1,name,value);
if rc1>0 then output;
n1+1;
end;
run;
proc sort data=attrprop;
by type name;
run;
也可以使用獲得該信息metabrowse
在基地SAS。
例如,為您感興趣的元對象調用此宏。 fullList 表將包含所有具有 metaId 和對象類型的有趣對象:
options Metaport=portnumber;
options MetaUser="userid";
options Metapass="password";
options MetaServer="serverName";
options metaprotocol=bridge;
data fullList;
length objName $60 objId $17 objType $50;;
delete;
run;
%macro getMeta(objType);
data temp(keep=objType objName objId);
length uri $256 objName $60 objId $17 objType $50;
uri="";n=1;TableName="";
objType="&objType";
do while(metadata_getnobj("omsobj:&objType?@Id ? '.'",n,uri) >= 0);
rc=metadata_getattr(uri,"Name",objName);
rc=metadata_getattr(uri,"Id",objId);
n=n+1;
output;
end;
run;
proc append base=fullList data=temp;
run;
%mend;
%getMeta(Person);
%getMeta(PhysicalTable);
%getMeta(Job);
%getMeta(JFob);
.
.
. if you want .....
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.