Hi,
I currently have been tasked with writing a SAS Program to report on:
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;
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.
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
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?
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
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.
%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
The SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment.
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.