Production Ready Macros for SAS Application Developers
https://github.com/sasjs/core
mm_getroles.sas
Go to the documentation of this file.
1 /**
2  @file mm_getroles.sas
3  @brief Creates a table containing a list of roles
4  @details
5 
6  Usage:
7 
8  %mm_getroles()
9 
10  @param outds the dataset to create that contains the list of roles
11 
12  @returns outds dataset containing all roles, with the following columns:
13  - uri
14  - name
15 
16  @warning The following filenames are created and then de-assigned:
17 
18  filename sxlemap clear;
19  filename response clear;
20  libname _XML_ clear;
21 
22  @version 9.3
23  @author Allan Bowe
24 
25 **/
26 
27 %macro mm_getroles(
28  outds=work.mm_getroles
29 )/*/STORE SOURCE*/;
30 
31 filename response temp;
32 options noquotelenmax;
33 proc metadata in= '<GetMetadataObjects><Reposid>$METAREPOSITORY</Reposid>
34  <Type>IdentityGroup</Type><NS>SAS</NS><Flags>388</Flags>
35  <Options>
36  <Templates><IdentityGroup Name="" Desc="" PublicType=""/></Templates>
37  <XMLSelect search="@PublicType=''Role''"/>
38  </Options>
39  </GetMetadataObjects>'
40  out=response;
41 run;
42 
43 filename sxlemap temp;
44 data _null_;
45  file sxlemap;
46  put '<SXLEMAP version="1.2" name="roles"><TABLE name="roles">';
47  put "<TABLE-PATH syntax='XPath'>/GetMetadataObjects/Objects/IdentityGroup</TABLE-PATH>";
48  put '<COLUMN name="roleuri">';
49  put "<PATH syntax='XPath'>/GetMetadataObjects/Objects/IdentityGroup/@Id</PATH>";
50  put "<TYPE>character</TYPE><DATATYPE>string</DATATYPE><LENGTH>32</LENGTH>";
51  put '</COLUMN><COLUMN name="rolename">';
52  put "<PATH syntax='XPath'>/GetMetadataObjects/Objects/IdentityGroup/@Name</PATH>";
53  put "<TYPE>character</TYPE><DATATYPE>string</DATATYPE><LENGTH>256</LENGTH>";
54  put '</COLUMN><COLUMN name="roledesc">';
55  put "<PATH syntax='XPath'>/GetMetadataObjects/Objects/IdentityGroup/@Desc</PATH>";
56  put "<TYPE>character</TYPE><DATATYPE>string</DATATYPE><LENGTH>500</LENGTH>";
57  put '</COLUMN></TABLE></SXLEMAP>';
58 run;
59 libname _XML_ xml xmlfileref=response xmlmap=sxlemap;
60 
61 proc sort data= _XML_.roles out=&outds;
62  by rolename;
63 run;
64 
65 filename sxlemap clear;
66 filename response clear;
67 libname _XML_ clear;
68 
69 %mend;