BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
merrittr
Obsidian | Level 7

Hi

I have a piece of code that lists all the objects (user or a group) that is a a member of another group

/*Connect to the metadata server.  */

options metaserver="biserver.whatever.com"

  metaport=8561

  metauser="sasadm@saspw"

  metapass="password"

  metarepository="Foundation";

%mduextr(libref=work)

proc sql;

  create table work.sasmembership as

  select distinct name 'name' as name , memName 'memName' as memName,'GROUP'

  from work.Groupmemgroups_info

  where substr(name,1,1) in ('p','v','f','w') or name in ('Report Developer','sqlserver','Report Viewer')

  UNION

  select distinct name 'name' as name , memName 'memName' as memName,'USER'

  from work.Groupmempersons_info

  where substr(name,1,1) in ('p','v','f','w') or name in ('Report Developer','sqlserver','Report Viewer');

quit;

what i want now is to be able to go through that group and isue a metadata command to add the member (be it a group or user) to the group

on another server is there a proc metadata command to add a group or user to a group?

ie

command bla addtogroup jeff destinationgroupname

or

command bla addtogroup group1 destinationgroup

1 ACCEPTED SOLUTION

Accepted Solutions
DavidStern
SAS Employee

Linus is right, so yes it is doable.

You can use the User Import Macros (of which %mduimplb is the one which does the loading of data from 'canonical' - i.e pre-defined format - tables into metadata), to make users and groups members of a group, even if you're not using it to add/update/delete any users or groups themselves. You will need to populate one of these canonical tables called grpmems, which has two columns: grpkeyid memkeyid. The first, grpkeyid is the ID for the group as it was loaded into metadata - the value depends on how the group was populated. The second column, memkeyid, can be a user keyid, or a group keyid. The User Import Macros are documented here, and the canonical tables illustrated here.



View solution in original post

4 REPLIES 4
LinusH
Tourmaline | Level 20

%mduimplb?

Data never sleeps
merrittr
Obsidian | Level 7

that seems to add users and groups to METADATA but it doesn't add users to groups or groups to groups correct?

I have all my users added and all my groups added via %mduimplb  now I need to populate the groups based on a query to an older server

that had all the users added to the groups manually. Is that doable?

DavidStern
SAS Employee

Linus is right, so yes it is doable.

You can use the User Import Macros (of which %mduimplb is the one which does the loading of data from 'canonical' - i.e pre-defined format - tables into metadata), to make users and groups members of a group, even if you're not using it to add/update/delete any users or groups themselves. You will need to populate one of these canonical tables called grpmems, which has two columns: grpkeyid memkeyid. The first, grpkeyid is the ID for the group as it was loaded into metadata - the value depends on how the group was populated. The second column, memkeyid, can be a user keyid, or a group keyid. The User Import Macros are documented here, and the canonical tables illustrated here.



merrittr
Obsidian | Level 7

Ah gotcha that makes sense thanks guys!

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 5026 views
  • 5 likes
  • 3 in conversation