mp_assertcolvals.sas File Reference

Asserts the values in a column. More...

Go to the source code of this file.

Detailed Description

Useful in the context of writing sasjs tests. The results of the test are appended to the &outds. table.

Example usage:

data work.checkds;
  do checkval='Jane','James','Jill';
    output;
  end;
run;
%mp_assertcolvals(sashelp.class.name,
  checkvals=work.checkds.checkval,
  desc=At least one value has a match,
  test=ANYVAL
)

data work.check;
  do val='M','F';
    output;
  end;
run;
%mp_assertcolvals(sashelp.class.sex,
  checkvals=work.check.val,
  desc=All values have a match,
  test=ALLVALS
)

SAS Macros

Parameters
[in]indscolThe input library.dataset.column to test for values
[in]checkvals=(0) A library.dataset.column value containing a UNIQUE list of values to be compared against the source (indscol).
[in]desc=(Testing observations) The user provided test description
[in]test=(ALLVALS) The test to apply. Valid values are:
  • ALLVALS - Test is a PASS if ALL values have a match in checkvals
  • ANYVAL - Test is a PASS if at least 1 value has a match in checkvals
  • NOVAL - Test is a PASS if there are NO matches in checkvals
[out]outds=(work.test_results) The output dataset to contain the results. If it does not exist, it will be created, with the following format:
TEST_DESCRIPTION:$256 TEST_RESULT:$4 TEST_COMMENTS:$256
User Provided description PASS Column &indscol contained ALL target vals

Related Macros

Version
9.2
Author
Allan Bowe

Definition in file mp_assertcolvals.sas.