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

Hi,

 

I currently have been tasked with writing a SAS Program to report on:

 

  • Users & Groups In SAS Smiley Happy
  • Groups & Roles In SAS Smiley Sad

I was able to extract Users & Groups Successfully with the below Program, but am stumped with the Groups & Roles. Would anybody be able to provide a similar program or way of obtaining the info?

 

Options metauser="XXXXXXX"

metaserver="XXXXXXX"

metaport=XXXXXX

metapass="XXXXXXXX"

metaprotocol=bridge

metarepository=Foundation;




data users_grps;

length uri name group groupuri $256 role roleuri $256 id $20;

 n=1;

 uri="";

 name="";

 group="";

 groupuri="";

 id="";

 nobj=metadata_getnobj("omsobj:Person?@Id contains '.'",n, 1);

if nobj=0 then put "No Persons available";

else do while (nobj > 0);

 

 rc=metadata_getattr(uri,"Name", Name); 

 a=1;

 grpassn=metadata_getnasn(uri, "IdentityGroups", a, groupuri);

if grpassn in (-3,-4) then do;

 group = "No Groups"; 

output;

end;

else do while (grpassn > 0 );

 rc2=metadata_getattr(groupuri, "Name", group);

 a+1;

output; 

 grpassn =metadata_getnasn(groupuri, "IdentityGroups", a, groupuri);

end;

 n+1;

 nobj=metadata_getnobj("omsobj:Person?@Id contains '.'",n,uri);

end;

keep name group;

run;

Proc Sort data=work.users_grps;

By name;

Run;

ods pdf file="\\Dub-sascp-d01\sasdata\USER_REPORTS\usergroups_%sysfunc(Today(), YYMMDDN8.)%sysfunc(Today(),HHMMSSN6.).pdf";

proc report data=users_grps nowd headline headskip;

columns name group;

define name / order 'User Name' format=$30.;

define group / order 'Group' format=$30.;

break after name / skip;

run;

ods pdf close;
1 ACCEPTED SOLUTION

Accepted Solutions
Resa
Pyrite | Level 9

Maybe the %MDUEXTR macro as described in the SAS Blog "SAS administrators tip: Keeping track of SAS users" could be helpfull for you. It generates various tables containing all the information you indicate.

 

From these tables you can basically generate any report you would like with regard to users, groups and roles.

View solution in original post

6 REPLIES 6
anja
SAS Employee

Hi,

 

take a look at the attached program. This was provided by someone a while back. It uses the API data step function.

You'll have to add your parameters for user ID and pwd (use unrestricted user).

 

The output is a data set with a list of user, groups and roles. This might give you the ground work and a starting point, and can be modified to fit your needs.

 

Best

Anja

anja
SAS Employee

Just ran your program .. and it gives you the same output already (listing groups, roles and users in one table).

Am curious, what is the reason for needing  2 reports, one for users & groups, a second one for groups & roles?

 

Have you looked at the environment manager reporting to see if this could help?

David_Luttrell
Obsidian | Level 7

Hi Anja,

 

A bit stumped with the groups and roles. Will Run your program to see if it resolves 🙂 Appreciate the feedback.  

 

like the groups and roles report would be, if you get me would be groups on the left, roles on the right:

 

SAS_DATAANALYST - Add in For Microsoft Office

                                     - Data Integration Object Reader

                                     - Enterprise Guide Advanced

SAS_SUPERUSER     - Metadata: Operation

                                     -Data Integration Object Developers

 

Kind Regards,

David

 

Resa
Pyrite | Level 9

Maybe the %MDUEXTR macro as described in the SAS Blog "SAS administrators tip: Keeping track of SAS users" could be helpfull for you. It generates various tables containing all the information you indicate.

 

From these tables you can basically generate any report you would like with regard to users, groups and roles.

David_Luttrell
Obsidian | Level 7
Thanks Resa,

That would actually make sense as we use it in our AD_Sync import. Great shout, am still yet to get around to testing the Anja and your programs so will get back to you on this later on.

Appreciate the help 🙂

Kind Regards,
David
David_Luttrell
Obsidian | Level 7

%MDUEXTR;

 

Seems like a more efficient way of getting the information required as opposed to messing with metadata. Appreciate you two working on this.

 

Kind Regards,

David

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
  • 6 replies
  • 2401 views
  • 4 likes
  • 3 in conversation