63 %MACRO assertColumns (i_expected     =      
 
   65                      ,i_desc         = Compare datasets
 
   67                      ,i_allow        = DSLABEL LABEL COMPVAR
 
   75    %LOCAL l_allowSymbols l_i l_j l_symboli l_symbolj l_potenz l_mask l_casid l_tstid l_path l_errMsg;
 
  101    %DO %WHILE(%length(%scan(&i_allow,%eval(&l_i+1),%str( ))));
 
  102       %LET l_i = %eval (&l_i + 1);
 
  103       %LET l_symboli = %upcase(%scan(&i_allow, &l_i, %str( )));
 
  106       %DO %WHILE(%length(%scan(&l_allowSymbols,%eval(&l_j+1),%str( ))));
 
  107          %LET l_j = %eval (&l_j+1);
 
  108          %LET l_symbolj = %scan(&l_allowSymbols, &l_j, %str( ));
 
  109          %IF &l_symboli = &l_symbolj %THEN %
goto label1;
 
  110          %LET l_potenz = &l_potenz*2;
 
  112       %PUT &g_error.(SASUNIT): assertColumns: invalid symbol &l_symboli in parameter i_allow;
 
  115       %LET l_mask = %sysfunc(bor(&l_mask, &l_potenz));
 
  119    %IF %length(&i_maxReportObs) %then %LET o_maxReportObs = &i_maxReportObs;
 
  122    %IF (%length(&i_include) > 0 AND %length(&i_exclude) > 0) %THEN %DO;
 
  123      %PUT &g_warning.(SASUNIT): Both parameters i_include and i_exclude have been set.;
 
  124      %PUT &g_warning.(SASUNIT): I_exclude parameter will be dropped;
 
  129    %GLOBAL g_inTestcase;
 
  130    %IF &g_inTestcase EQ 1 %THEN %DO;
 
  133    %ELSE %IF &g_inTestcase NE 2 %THEN %DO;
 
  134       %PUT &g_error.(SASUNIT): assert must be called after initTestcase;
 
  139    %_getScenarioTestId (i_scnid=&g_scnid, r_casid=l_casid, r_tstid=l_tstid);
 
  141    %*** create subfolder ***;
 
  142    %_createTestSubfolder (i_assertType   =assertcolumns
 
  149    libname _acLib 
"&l_path.";
 
  152    %LOCAL l_rc l_actual; 
 
  153    %IF NOT %sysfunc(exist(&i_actual,DATA)) AND NOT %sysfunc(exist(&i_actual,VIEW)) %THEN %DO;
 
  155       %LET l_actual=ERROR: actual table not found.;
 
  156       %LET l_errMsg=Actual table (&i_actual.) could not be found!;
 
  160    %ELSE %IF NOT %sysfunc(exist(&i_expected,DATA)) AND NOT %sysfunc(exist(&i_expected,VIEW))%THEN %DO;
 
  162       %LET l_actual=&l_actual ERROR: expected table not found.;
 
  163       %LET l_errMsg=Expected table (&i_expected.) could not be found!;
 
  169       %LOCAL l_formchar l_orientation l_compResult;
 
  170       %LET l_formchar=%sysfunc(getoption(formchar));
 
  171       %LET l_orientation=%sysfunc(getoption(orientation));
 
  173       OPTIONS FORMCHAR="|----|+|---+=|-/\<>*";
 
  174       OPTIONS ORIENTATION=portrait;
 
  176       ODS DOCUMENT NAME=_acLib._columns_rep(WRITE);
 
  180          BASE=&i_expected %IF %quote(&i_exclude) NE %THEN %str(%(DROP= &i_exclude%));
 
  181          COMPARE=&i_actual %IF %quote(&i_exclude) NE %THEN %str(%(DROP= &i_exclude%));
 
  183          %IF %quote(&i_fuzz) NE %THEN CRITERION=&i_fuzz METHOD=ABSOLUTE;
 
  185          %IF %quote(&i_id) NE %THEN %str(ID &i_id;);
 
  186          %IF %quote(&i_include) NE %THEN %str(VAR &i_include;);
 
  188       %PUT &g_note.(SASUNIT): sysinfo = &sysinfo;
 
  189       %LET l_compResult = &sysinfo;
 
  192       OPTIONS FORMCHAR="&l_formchar.";
 
  193       OPTIONS ORIENTATION=&l_orientation.;
 
  196       %LET l_rc=%eval((%sysfunc(bxor(%sysfunc(bor(&l_mask,&l_compResult)),&l_mask)) NE 0)*2);
 
  201       %DO %WHILE(%length(%scan(&l_allowSymbols,%eval(&l_j+1),%str( ))));
 
  202          %LET l_j = %eval (&l_j+1);
 
  203          %LET l_symbolj = %scan(&l_allowSymbols, &l_j, %str( ));
 
  204          %IF %sysfunc(band(&l_compResult, &l_potenz)) %THEN %DO;
 
  205             %LET l_actual = &l_actual &l_symbolj;
 
  207          %LET l_potenz = &l_potenz*2;
 
  210       %IF (&l_rc eq 2) %THEN %DO;
 
  211          %LET l_errMsg=%str(Allowed return codes are %upcase(&i_allow), comparing &i_expected. with &i_actual. resulted in these return codes &l_actual.);
 
  216    %_asserts(i_type     = assertColumns
 
  217             ,i_expected = %upcase(&i_allow)
 
  218             ,i_actual   = &l_actual.
 
  221             ,i_errMsg   = &l_errMsg.
 
  225    %IF &o_maxreportobs NE 0 %THEN %DO;
 
  226       %IF %sysfunc(exist(&i_expected,DATA)) OR %sysfunc(exist(&i_expected,VIEW)) %THEN %DO;
 
  227          DATA _acLib._columns_exp;
 
  228             SET &i_expected (obs=&o_maxReportObs.);
 
  232       %IF %sysfunc(exist(&i_actual,DATA)) OR %sysfunc(exist(&i_actual,VIEW)) %THEN %DO;
 
  233          DATA _acLib._columns_act;
 
  234             SET &i_actual (obs=&o_maxReportObs.);