Production Ready Macros for SAS Application Developers
https://github.com/sasjs/core
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;

SAS Macros

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 @LI ATLEAST [integer] - Test passes if row count is more than or equal to the provided integer @LI 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

Related Macros

Version
9.2
Author
Allan Bowe

Definition in file mp_assertdsobs.sas.