如何在SAS中获取元数据对象的详细信息

如何在SAS中获取元数据对象的详细信息,sas,Sas,我有一个存储库中的元数据对象列表。我已经获取了所有SASBrary、PhysicalTable和Jobs对象。现在我需要把他们所有的细节都拿来。有人能建议我怎么做吗?我是SAS DI新手,需要使用SAS代码获取详细信息。 谢谢好的,假设您有一个包含这些对象的数据集(have),并且uri存储在一个名为uri的变量中,那么以下内容就足够了: data associations; keep assoc assocuri name; length assoc assocuri name $25

我有一个存储库中的元数据对象列表。我已经获取了所有SASBrary、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;

也可以使用基本SAS中的
metabrowse
获取此信息。

例如,为您感兴趣的元对象调用此宏。完整列表表将包含所有具有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 ..... 

提供更多信息,谢谢艾伦。我不太熟悉元数据标识符,但我认为每个对象的元数据Id都将用作URI。正如您所建议的,我使用此代码获取元数据对象github.com/Boemska/macrocore/blob/master/meta/mm_getobjects.sas,并将Id重命名为URI。我用它来获取物理表、Sas库和作业的OBEJCT。代码是否可以帮助我获得所有详细信息,如作业/库/表的路径,以及所有这些类型对象的其他属性?^^这是另一个问题:-)我尝试了代码,但没有获得关于属性的更多详细信息,如物理路径、架构名称等。我在这里发布了一个更明确的问题: