Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_assertcolvals.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mp_assertcolvals macro
4
5 <h4> SAS Macros </h4>
6 @li mddl_assert.sas
7 @li mp_assertcolvals.sas
8 @li mp_assert.sas
9 @li mp_assertmodel.sas
10
11**/
12
13
14data work.checkds;
15 do checkval='Jane','James','Jill';
16 output;
17 end;
18run;
19%mp_assertcolvals(sashelp.class.name,
20 checkvals=work.checkds.checkval,
21 desc=At least one value has a match,
22 test=ANYVAL
23)
24
25data work.check;
26 do val='M','F';
27 output;
28 end;
29run;
30%mp_assertcolvals(sashelp.class.sex,
31 checkvals=work.check.val,
32 desc=All values have a match,
33 test=ALLVALS
34)
35
36/* Failure rows are isolated from the suite results and must append intact. */
37%mp_assertcolvals(sashelp.class.sex,
38 checkvals=work.check.val, test=NOVAL,
39 desc=Expected NOVAL failure, outds=work.colval_results)
40%mp_assertcolvals(sashelp.class.sex,
41 checkvals=work.check.val, test=ALLVALS,
42 desc=Expected ALLVALS pass, outds=work.colval_results)
43proc sql noprint;
44 select count(*) into: ncolvalfail trimmed from work.colval_results
45 where test_result='FAIL' and test_description='Expected NOVAL failure'
46 and test_comments contains 'has 0/'
47 and test_comments contains 'not in work.check.val';
48 select count(*) into: ncolvalpass trimmed from work.colval_results
49 where test_result='PASS' and test_description='Expected ALLVALS pass';
50 select count(*) into: ncolvaltotal trimmed from work.colval_results;
51quit;
52%mp_assert(iftrue=(&ncolvalfail=1 and &ncolvalpass=1 and &ncolvaltotal=2),
53 desc=Checking colvals FAIL details and appended PASS)
54
55%mddl_assert(work.assert_schema)
56%mp_assertmodel(work.colval_results,base=work.assert_schema,
57 desc=Checking mp_assertcolvals output schema)