13 length
id 8 region $4 value $12;
14 call missing(
id,region,value);
19 length value $12 region $4
id 8;
20 id=1; region=
'A'; value=
'one'; output;
21 id=1; region=
'B'; value=
'two'; output;
30 length
id 8 region $4 value $11;
31 call missing(
id,region,value);
43 if id=1 then region=
' ';
47%mp_assertscope(SNAPSHOT)
48%mp_assertmodel(work.match,base=work.model,key=
id region,
49 desc=match,outds=work.model_results)
50%mp_assertscope(COMPARE,desc=Model assertion does not leak macro variables)
51%mp_assertmodel(work.model,base=work.model,key=
id,
52 desc=empty,outds=work.model_results)
53%mp_assertmodel(work.extra,base=work.model,
54 desc=extra,outds=work.model_results)
55%mp_assertmodel(work.wronglen,base=work.model,
56 desc=length,outds=work.model_results)
57%mp_assertmodel(work.duplicate,base=work.model,key=
id region,
58 desc=duplicate,outds=work.model_results)
59%mp_assertmodel(work.missingkey,base=work.model,key=
id region,
60 desc=missing_key,outds=work.model_results)
61%mp_assertmodel(work.match,base=work.model,key=absent,
62 desc=unknown_key,outds=work.model_results)
63%mp_assertmodel(work.notfound,base=work.model,
64 desc=missing_input,outds=work.model_results)
67 length test_description $256 test_result $5 reason $80;
68 infile datalines dlm=
'|' truncover;
69 input test_description $ test_result $ reason $;
71match|PASS|Column model and key match
72empty|PASS|Column model and key match
73extra|FAIL|Column count differs
74length|FAIL|Type or length differs
75duplicate|FAIL|Key contains missing or duplicate
76missing_key|FAIL|Key contains missing or duplicate
77unknown_key|FAIL|Key column not found
78missing_input|FAIL|Input dataset cannot be opened
83 select count(*),count(distinct e.test_description)
84 into :model_rows trimmed,:model_matches trimmed
85 from work.model_results as a left join work.expected as e
86 on a.test_description=e.test_description
87 and a.test_result=e.test_result
88 and index(a.test_comments,strip(e.reason))>0;
90%mp_assert(iftrue=(&model_rows=8 and &model_matches=8),
91 desc=Model results match expected pass and fail cases)
94%let model_syntax=%sysfunc(getoption(syntaxcheck,keyword));
96%mp_assertmodel(work.match,base=work.model,outds=work.match)
97%let model_errorcc=&syscc;
101 select count(*) into :model_input_rows trimmed from work.match;
103%mp_assert(iftrue=(&model_errorcc>4 and &model_input_rows=2),
104 desc=Overlapping output is rejected and input preserved)