1

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.

Richard
  • 25,390
  • 3
  • 25
  • 38
Azeem112
  • 337
  • 1
  • 8
  • 23

1 Answers1

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

Allan Bowe
  • 12,306
  • 19
  • 75
  • 124
  • PROC METADATA metaserver="server" metaport=8561 metauser="sasadm@saspw" metapass="xxxxx" PROTOCOL=BRIDGE in=" "; run; This is what i Tried to do as well, but getting an error that "The routine name person is invalid" – Azeem112 Apr 27 '19 at 09:55
  • you'll need to use the `updateMetadata` method: http://support.sas.com/documentation/cdl/en/omaref/63063/HTML/default/viewer.htm#n1m5lk37gs2bzmn1qyqy1ac1kr6v.htm – Allan Bowe Apr 27 '19 at 15:04