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