Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_assertdsobs.sas File Reference

Asserts the number of observations in a dataset. 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:

%mp_assertdsobs(sashelp.class) %* tests if any observations are present;

%mp_assertdsobs(sashelp.class,test=ATLEAST 10) %* pass if >9 obs present;

%mp_assertdsobs(sashelp.class,test=ATMOST 20) %* pass if <21 obs present;
Parameters
[in]indsinput dataset to test for presence of observations
[in]desc=(Testing observations) The user provided test description
[in]test=(HASOBS) The test to apply. Valid values are:
  • HASOBS - Test is a PASS if the input dataset has any observations
  • EMPTY - Test is a PASS if input dataset is empty
  • EQUALS [integer] - Test passes if row count matches the provided integer
  • ATLEAST [integer] - Test passes if row count is more than or equal to the provided integer
  • ATMOST [integer] - Test passes if row count is less than or equal to the provided integer
[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 Dataset &inds has XX obs

SAS Macros

Related Macros

Version
9.2
Author
Allan Bowe

Definition in file mp_assertdsobs.sas.