CORE
mm_getgroupmembers.sas
Go to the documentation of this file.
1 
18 %macro mm_getgroupmembers(
19  group /* metadata group for which to bring back members */
20  ,outds=work.mm_getgroupmembers /* output dataset to contain the results */
21  ,id=NO /* set to yes if passing an ID rather than group name */
22  );
23 
24  data &outds ;
25  attrib uriGrp uriMem GroupId GroupName Group_or_Role MemberName MemberType
26  length=$64
27  GroupDesc length=$256
28  rcGrp rcMem rc i j length=3;
29  call missing (of _all_);
30  drop uriGrp uriMem rcGrp rcMem rc i j;
31 
32  i=1;
33  * Grab the URI for the first Group ;
34  %if &id=NO %then %do;
35  rcGrp=metadata_getnobj("omsobj:IdentityGroup?@Name='&group'",i,uriGrp);
36  %end;
37  %else %do;
38  rcGrp=metadata_getnobj("omsobj:IdentityGroup?@Id='&group'",i,uriGrp);
39  %end;
40  * If Group found, enter do loop ;
41  if rcGrp>0 then do;
42  call missing (rcMem,uriMem,GroupId,GroupName,Group_or_Role
43  ,MemberName,MemberType);
44  * get group info ;
45  rc = metadata_getattr(uriGrp,"Id",GroupId);
46  rc = metadata_getattr(uriGrp,"Name",GroupName);
47  rc = metadata_getattr(uriGrp,"PublicType",Group_or_Role);
48  rc = metadata_getattr(uriGrp,"Desc",GroupDesc);
49  j=1;
50  do while (metadata_getnasn(uriGrp,"MemberIdentities",j,uriMem) > 0);
51  call missing (MemberName,MemberType);
52  rc = metadata_getattr(uriMem,"Name",MemberName);
53  rc = metadata_getattr(uriMem,"PublicType",MemberType);
54  output;
55  j+1;
56  end;
57  end;
58  run;
59 
60 %mend;