BookmarkSubscribeRSS Feed
Obsidian | Level 7
I am trying to develop a code which make a list of metadata users and their roles (not groups)

for example
userA is the part of roleA and groupA
And groupA is the part of groupB
And groupB is the part of roleB roleC

final output should be
userA roleA
userA roleB
userA roleC
Meteorite | Level 14

Unless there are other exclusions and conflicts, userA will be a member of Roles A,B and C.
As a general rule if there are conflicts , then permissions are denied.

Obsidian | Level 7
I am looking for code which make list of users and their roles (including nested)

There are numerous posts on this topic in the Admin & Deploy forum like this one:


I'll leave you to search for others.

Obsidian | Level 7
I am looking for nested membership, sas have inbuilt macros to extract direct group/roles but when it comes to nested groups , it becomes tricky

I have user a mduextr macro output and have done some base sas program on the output to achieve desired result but code is not very good currently, hopefully i will be able to optimise it

@gwootton is a great help on unravelling the complexities of SAS metadata. Maybe he can help in this case. But I suggest you search the admin forum for "metadata roles" to see if there are more relevant solutions to try.

Obsidian | Level 7
I haven’t been able to find any existing code which takes care of nested memberships, currently I am working on it and hopefully I will be able to post the final code in some days.

The idea is to use mduextr macro and then use the output tables , perform conditional nested loops and joins to achieve the the desired output
This code to identify circular memberships might be helpful:

Circular Metadata-Group Membership Can Make You Dizzy!

The first half of this code builds from the MDUEXTR a parent/child data set (ALLGROUPS).

From there I suppose it would be a matter of associating the roles down that tree and in a data set and then translating that based on direct group membership for the users.
Greg Wootton | Principal Systems Technical Support Engineer
Rhodochrosite | Level 12

I'm not sure if you are open to using a commercial product for this but if you are then you could consider our Metacoda Plug-ins Role Reviewer. It is a plug-in to SAS Management Console that presents a list of roles and their members via direct membership, indirect membership and implicit membership. Here is a sample screenshot:



It will also gracefully handle infinite loops in group memberships and role contributions and show/hide duplicate membership paths. If you are interested in capabilities then it also shows which capabilities are granted to members, directly or indirectly through role contributions. All of this information is available to export to HTML for security documentation purposes.

The plug-in will help if you want to quickly answer a question of who are all the members of this role and by what path or paths are they a member. If you are after the underlying data to do custom reporting not available in the plug-ins themselves then it can be exported into an XML format for which we provide SAS XML Libname Engine maps to query them as SAS tables - see


If this is of interest and you would like to try it out for yourself (as well as all of the other included plug-ins) then you can sign up for a free 30 day evaluation at  I'd be happy to arrange a web meeting to go through them in more detail if you like.

Obsidian | Level 7
Yes - metacoda is amazing and can help in many ways, but unfortunately currently we are just looking for above solution. Our metadata is not too complicated and easy to understand 🙂

Thanks for your suggestions

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
  • 9 replies
  • 5 in conversation