问题
I've around 600 meta users in SAS EGRC 6.1 in the platform in SAS 9.4.
I want to add those users to a meta-group. for this, I'm using code below
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);
for the final updated I tried both %mduchgl and %mduchglb but with both, I'm not able to get the desired results. I test it with one user.
with %mduchgl I get the below error
The symbolic reference for A52PDIUF.$A52PDIUF.AP0000NI did not resolve.
with %mduchglb I get the below error
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.
Any suggestions that how can I resolve the error or another approach that I should try to achieve this.
Thanks.
回答1:
I don't think you should ever modify those datasets! Everything you need to achieve should be possible using proc metadata
(or data step functions as last resort).
Here is a relevant SAS Communities thread. To summarise - the following snippet will add a group to a user, so long as you have the group / user URI:
<Person Id="A5NUQPXO.AP00002V">
<IdentityGroups>
<IdentityGroup ObjRef="A5NUQPXO.A500001C" />
</IdentityGroups>
</Person>
UPDATE - for completeness, I turned this into a macro, described here
https://core.sasjs.io/mm__adduser2group_8sas.html
来源:https://stackoverflow.com/questions/55873870/adding-a-meta-user-to-a-meta-group-in-sas