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 [out] 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
31filename response temp;
32options noquotelenmax;
33proc 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;
41run;
42
43filename sxlemap temp;
44data _null_;
45 file sxlemap;
46 put '<SXLEMAP version="1.2" name="roles"><TABLE name="roles">';
47 put "<TABLE-PATH syntax='XPath'>/GetMetadataObjects/Objects/IdentityGroup";
48 put "</TABLE-PATH>";
49 put '<COLUMN name="roleuri">';
50 put "<PATH syntax='XPath'>/GetMetadataObjects/Objects/IdentityGroup/@Id";
51 put "</PATH>";
52 put "<TYPE>character</TYPE><DATATYPE>string</DATATYPE><LENGTH>32</LENGTH>";
53 put '</COLUMN><COLUMN name="rolename">';
54 put "<PATH syntax='XPath'>/GetMetadataObjects/Objects/IdentityGroup/@Name";
55 put "</PATH>";
56 put "<TYPE>character</TYPE><DATATYPE>string</DATATYPE><LENGTH>256</LENGTH>";
57 put '</COLUMN><COLUMN name="roledesc">';
58 put "<PATH syntax='XPath'>/GetMetadataObjects/Objects/IdentityGroup/@Desc";
59 put "</PATH>";
60 put "<TYPE>character</TYPE><DATATYPE>string</DATATYPE><LENGTH>500</LENGTH>";
61 put '</COLUMN></TABLE></SXLEMAP>';
62run;
63libname _XML_ xml xmlfileref=response xmlmap=sxlemap;
64
65proc sort data= _XML_.roles out=&outds;
66 by rolename;
67run;
68
69filename sxlemap clear;
70filename response clear;
71libname _XML_ clear;
72
73%mend mm_getroles;