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