From 6c6b55dceaec159e2334f04d1735f91017d2cf1f Mon Sep 17 00:00:00 2001 From: munja Date: Thu, 23 Dec 2021 19:29:37 +0000 Subject: [PATCH] chore: updating header, adding stop statement in mp_makedata(), writing test for mf_existvar() --- base/mf_existvar.sas | 8 ++++++-- base/mp_makedata.sas | 1 + tests/crossplatform/mf_existvar.test.sas | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 tests/crossplatform/mf_existvar.test.sas diff --git a/base/mf_existvar.sas b/base/mf_existvar.sas index 90cd34d..4ca518d 100755 --- a/base/mf_existvar.sas +++ b/base/mf_existvar.sas @@ -7,8 +7,12 @@ %put %mf_existvar(work.someds, somevar) - @param libds (positional) - 2 part dataset or view reference - @param var (positional) - variable name + @param [in] libds 2 part dataset or view reference + @param [in] var variable name + +

Related Macros

+ @li mf_existvar.test.sas + @version 9.2 @author Allan Bowe **/ diff --git a/base/mp_makedata.sas b/base/mp_makedata.sas index 0b583d3..eb7e98a 100644 --- a/base/mp_makedata.sas +++ b/base/mp_makedata.sas @@ -92,6 +92,7 @@ data &ds2; %end; output; end; + stop; run; proc sort data=&ds2 nodupkey; by &pk_fields; diff --git a/tests/crossplatform/mf_existvar.test.sas b/tests/crossplatform/mf_existvar.test.sas new file mode 100644 index 0000000..efb6ca9 --- /dev/null +++ b/tests/crossplatform/mf_existvar.test.sas @@ -0,0 +1,22 @@ +/** + @file + @brief Testing mf_existvar macro + +

SAS Macros

+ @li mf_existvar.sas + @li mp_assert.sas + +**/ + + +%mp_assert( + iftrue=(%mf_existvar(sashelp.class,age)=1), + desc=Checking existing var exists, + outds=work.test_results +) + +%mp_assert( + iftrue=(%mf_existvar(sashelp.class,isjustanumber)=0), + desc=Checking non existing var does not exist, + outds=work.test_results +) \ No newline at end of file