Macros for SAS Application Developers
https://github.com/sasjs/core
ms_getusers.test.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Testing ms_getusers.sas macro
4 
5  <h4> SAS Macros </h4>
6  @li ms_creategroup.sas
7  @li ms_adduser2group.sas
8  @li ms_getusers.sas
9  @li mp_assertdsobs.sas
10  @li mp_assertscope.sas
11 
12 **/
13 
14 
15 %mp_assertscope(SNAPSHOT)
16 %ms_getusers(outds=work.test1,mdebug=&sasjs_mdebug)
17 %mp_assertscope(COMPARE
18  ,ignorelist=MCLIB0_JADP1LEN MCLIB0_JADPNUM MCLIB0_JADVLEN
19 )
20 
21 %mp_assertdsobs(work.test1,test=ATLEAST 1)
22 
23 /**
24  * test the extraction of group members
25  */
26 
27 /* create a group */
28 %let group=%substr(%mf_getuniquename(),1,8);
29 %ms_creategroup(&group, desc=some desc,mdebug=&sasjs_mdebug,outds=work.group)
30 %let gid=0;
31 data _null_;
32  set work.group;
33  call symputx('gid',groupid);
34 run;
35 
36 /* add a member */
37 %ms_adduser2group(uid=1,gid=&gid)
38 
39 /* extract the members */
40 %ms_getusers(group=&group,outds=test2)
41 
42 /* check the user is in the output list */
43 %let checkid=0;
44 data _null_;
45  set work.test2;
46  if id=1 then call symputx('checkid',1);
47 run;
48 %mp_assert(
49  iftrue=(&checkid=1),
50  desc=Checking that admin user was created in the new group,
51  outds=work.test_results
52 )
53 
54 
55 
56 
57 
58