Macros for SAS Application Developers
https://github.com/sasjs/core
mf_existvar.test.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Testing mf_existvar macro
4 
5  <h4> SAS Macros </h4>
6  @li mf_existvar.sas
7  @li mp_assert.sas
8 
9 **/
10 
11 
12 %mp_assert(
13  iftrue=(%mf_existvar(sashelp.class,age)>0),
14  desc=Checking existing var exists
15 )
16 
17 %mp_assert(
18  iftrue=(%mf_existvar(sashelp.class,isjustanumber)=0),
19  desc=Checking non existing var does not exist
20 )
21 
22 data work.lockcheck;
23  a=1;
24  output;
25  stop;
26 run;
27 
28 %mp_assert(
29  iftrue=(%mf_existvar(work.lockcheck,)=0),
30  desc=Checking non-provided var does not exist
31 )
32 
33 proc sql;
34 update work.lockcheck set a=2;
35 
36 %mp_assert(
37  iftrue=(&syscc=0),
38  desc=Checking the lock was released,
39  outds=work.test_results
40 )