Production Ready Macros for SAS Application Developers
https://github.com/sasjs/core
mm_getusers.sas
Go to the documentation of this file.
1/**
2 @file mm_getusers.sas
3 @brief Creates a table containing a list of all users
4 @details Only shows a limited number of attributes as some sites will have a
5 LOT of users.
6
7 Usage:
8
9 %mm_getusers()
10
11 @param outds the dataset to create that contains the list of libraries
12
13 @returns outds dataset containing all users, 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_getusers(
29 outds=work.mm_getusers
30)/*/STORE SOURCE*/;
31
32filename response temp;
33proc metadata in= '<GetMetadataObjects>
34 <Reposid>$METAREPOSITORY</Reposid>
35 <Type>Person</Type>
36 <NS>SAS</NS>
37 <Flags>0</Flags>
38 <Options>
39 <Templates>
40 <Person Name=""/>
41 </Templates>
42 </Options>
43 </GetMetadataObjects>'
44 out=response;
45run;
46
47filename sxlemap temp;
48data _null_;
49 file sxlemap;
50 put '<SXLEMAP version="1.2" name="SASObjects"><TABLE name="SASObjects">';
51 put "<TABLE-PATH syntax='XPath'>/GetMetadataObjects/Objects/Person";
52 put "</TABLE-PATH>";
53 put '<COLUMN name="uri">';
54 put "<PATH syntax='XPath'>/GetMetadataObjects/Objects/Person/@Id</PATH>";
55 put "<TYPE>character</TYPE><DATATYPE>string</DATATYPE><LENGTH>32</LENGTH>";
56 put '</COLUMN><COLUMN name="name">';
57 put "<PATH syntax='XPath'>/GetMetadataObjects/Objects/Person/@Name</PATH>";
58 put "<TYPE>character</TYPE><DATATYPE>string</DATATYPE><LENGTH>256</LENGTH>";
59 put '</COLUMN></TABLE></SXLEMAP>';
60run;
61libname _XML_ xml xmlfileref=response xmlmap=sxlemap;
62
63proc sort data= _XML_.SASObjects out=&outds;
64 by name;
65run;
66
67filename sxlemap clear;
68filename response clear;
69libname _XML_ clear;
70
71%mend mm_getusers;