将元用户添加到sas中的元组

时间:2019-04-26 19:29:12

标签: sas sas-macro

我在SAS 9.4平台的SAS EGRC 6.1中有大约600个元用户。

我想将这些用户添加到元组中。为此,我正在使用下面的代码

libname current '/tmp/temp1';   /* for the current metadata */

libname addgrps '/tmp/temp2';  /* current augmented with the changes */

libname updates '/tmp/temp3';  /* for the updates created by the mducmp macro */


options metaserver=abc

        metaport=8561

        metauser='sasadm@saspw'

        metapass='xyz123'

        metaprotocol=bridge

        metarepository=foundation;


%mduextr(libref=current);


proc copy in = current out = addgrps;
/*copy the current data to the directory for the target */
run;

data investigators_1;
set current.person;
where name in ('5806036');
rename objid = memkeyid;
keep objid;
run;


data investigator_group_1;
set current.group_info;
where name='Enterprise GRC: Incident Investigation';
rename id = grpkeyid;
keep id;
run;


proc sql;
create table grpmems as
select * from investigators_1, investigator_group_1;
quit;


proc append base = addgrps.grpmems data = grpmems;
run;


/* use the mducmp macro to create the updates data */
%mducmp(master=addgrps, target=current, change=updates)

/* validate the change data sets */
%mduchgv(change=updates, target=current, temp=work, errorsds=work.mduchgverrors)

/* apply the updates */
%mduchgl(change=updates);

对于最终更新,我尝试了%mduchgl和%mduchglb,但同时使用它们,都无法获得预期的结果。我测试了一个用户。

与%mduchgl一起出现以下错误

The symbolic reference for A52PDIUF.$A52PDIUF.AP0000NI did not resolve.

使用%mduchglb我得到以下错误

The object reference to Person was requested without an identifier.
Errors returned from Proc Metadata prevented objects from being Added, Updated, or Deleted.  Table: work.mduchglb_failedobjs 
identifies 1 such objects.  Consult the SAS Log for the specific Metadata Server errors returned.

关于如何解决该错误的任何建议,或者我应该尝试实现的另一种方法。

谢谢。

1 个答案:

答案 0 :(得分:0)

我认为您不应该修改这些数据集!您需要使用proc metadata(或数据步函数作为最后的手段)来实现您需要实现的所有功能。

这里是相关的SAS社区thread。总结-以下代码段将向用户添加组,只要您具有组/用户URI:

<Person Id="A5NUQPXO.AP00002V">
  <IdentityGroups>
    <IdentityGroup ObjRef="A5NUQPXO.A500001C" />
  </IdentityGroups>
</Person>

如果您有权访问基本SAS,则可以使用metabrowse来了解有关元数据中关系的更多信息。如果您不这样做,请考虑使用此(开源)应用程序进行基于浏览器的元数据探索:https://github.com/Boemska/metanav(免责声明-我在Boemska工作)

更新-为了完整起见,我将其变成了一个宏,可在此处

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