Architecting, installing and maintaining your SAS environment

SAS Program for Reporting Groups and Roles at the Same Time

Accepted Solution Solved
Reply
Contributor
Posts: 22
Accepted Solution

SAS Program for Reporting Groups and Roles at the Same Time

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;

Accepted Solutions
Solution
‎07-26-2016 07:32 AM
Frequent Contributor
Posts: 87

Re: SAS Program for Reporting Groups and Roles at the Same Time

Posted in reply to David_Luttrell

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


All Replies
SAS Super FREQ
Posts: 299

Re: SAS Program for Reporting Groups and Roles at the Same Time

Posted in reply to David_Luttrell

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

Attachment
SAS Super FREQ
Posts: 299

Re: SAS Program for Reporting Groups and Roles at the Same Time

Posted in reply to David_Luttrell

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?

Contributor
Posts: 22

Re: SAS Program for Reporting Groups and Roles at the Same Time

Hi Anja,

 

A bit stumped with the groups and roles. Will Run your program to see if it resolves Smiley Happy 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

 

Solution
‎07-26-2016 07:32 AM
Frequent Contributor
Posts: 87

Re: SAS Program for Reporting Groups and Roles at the Same Time

Posted in reply to David_Luttrell

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.

Contributor
Posts: 22

Re: SAS Program for Reporting Groups and Roles at the Same Time

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 Smiley Happy

Kind Regards,
David
Contributor
Posts: 22

Re: SAS Program for Reporting Groups and Roles at the Same Time

Posted in reply to David_Luttrell

%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

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 421 views
  • 3 likes
  • 3 in conversation