26 %MACRO assertRecordExists (i_dataset =
28 ,i_desc = Check
for existence of specific records
33 %IF &g_inTestcase EQ 1 %THEN %DO;
36 %ELSE %IF &g_inTestcase NE 2 %THEN %DO;
37 %PUT &g_error.(SASUNIT): assert must be called after initTestcase;
41 %LOCAL l_countMatches l_rc l_errMsg;
42 %LET l_countMatches = -1;
46 %IF NOT %SYSFUNC(EXIST(&i_dataset.)) %THEN %DO;
48 %LET l_errMsg=input dataset &i_dataset. does not exist!;
53 %IF %LENGTH(&i_whereExpr) = 0 %THEN %DO;
55 %LET l_errMsg=where expression is empty!;
60 SELECT COUNT(*) FORMAT=best12. INTO :l_countMatches
61 FROM &i_dataset(WHERE=(%nrbquote(&i_whereExpr)))
65 %LET l_countMatches = &l_countMatches;
67 %IF %eval(&l_countMatches >= 1)
71 %LET l_errMsg=No matching records were found!;
75 %_asserts(i_type = assertRecordExists
77 ,i_actual = &l_countMatches.
80 ,i_errMsg = &l_errMsg.
83 %MEND assertRecordExists;