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

Asserts the existence (or not) of columns. 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_assertcols(sashelp.class,
  cols=name age sex,
  test=ALL,
  desc=check all columns exist
)

%mp_assertcols(sashelp.class,
  cols=a b c,
  test=NONE
)

%mp_assertcols(sashelp.class,
  cols=age depth,
  test=ANY
)

SAS Macros

Parameters
[in]indsThe input library.dataset to test for values
[in]cols=(0) The list of columns to check for
[in]desc=(0) The user provided test description
[in]test=(ALL) The test to apply. Valid values are:
  • ALL - Test is a PASS if ALL columns exist in &inds
  • ANY - Test is a PASS if ANY of the columns exist in &inds
  • NONE - Test is a PASS if NONE of the columns exist in &inds
[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 contained ALL columns

Related Macros

Version
9.2
Author
Allan Bowe

Definition in file mp_assertcols.sas.