1
0
mirror of https://github.com/sasjs/core.git synced 2025-12-11 06:24:35 +00:00

Merge pull request #163 from sasjs/mf_verfiy

fix: updating mf_abort param in mf_verifymacvars, also fixing return …
This commit is contained in:
Allan Bowe
2022-02-06 17:16:54 +02:00
committed by GitHub
3 changed files with 48 additions and 12 deletions

19
all.sas
View File

@@ -1807,7 +1807,7 @@ Usage:
%mend mf_uid;/**
@file
@brief Checks if a set of macro variables exist / contain values.
@brief Checks if a set of macro variables exist AND contain values.
@details Writes ERROR to log if abortType is SOFT, else will call %mf_abort.
Usage:
@@ -1821,10 +1821,11 @@ Usage:
<h4> SAS Macros </h4>
@li mf_abort.sas
@param verifyvars space separated list of macro variable names
@param makeupcase= set to YES to convert all variable VALUES to
@param [in] verifyvars Space separated list of macro variable names
@param [in] makeupcase= (NO) Set to YES to convert all variable VALUES to
uppercase.
@param mAbort= Abort Type. Default is SOFT (writes err to log).
@param [in] mAbort= (SOFT) Abort Type. When SOFT, simply writes an err
message to the log.
Set to any other value to call mf_abort (which can be configured to abort in
various fashions according to context).
@@ -1865,9 +1866,15 @@ Usage:
%goto exit_success;
%exit_err:
%if &mAbort=SOFT %then %put %str(ERR)OR: &abortmsg;
%else %mf_abort(mac=mf_verifymacvars,type=&mabort,msg=&abortmsg);
%put %str(ERR)OR: &abortmsg;
%mf_abort(iftrue=(&mabort ne SOFT),
mac=mf_verifymacvars,
msg=%str(&abortmsg)
)
0
%return;
%exit_success:
1
%mend mf_verifymacvars;
/**

View File

@@ -1,6 +1,6 @@
/**
@file
@brief Checks if a set of macro variables exist / contain values.
@brief Checks if a set of macro variables exist AND contain values.
@details Writes ERROR to log if abortType is SOFT, else will call %mf_abort.
Usage:
@@ -14,10 +14,11 @@
<h4> SAS Macros </h4>
@li mf_abort.sas
@param verifyvars space separated list of macro variable names
@param makeupcase= set to YES to convert all variable VALUES to
@param [in] verifyvars Space separated list of macro variable names
@param [in] makeupcase= (NO) Set to YES to convert all variable VALUES to
uppercase.
@param mAbort= Abort Type. Default is SOFT (writes err to log).
@param [in] mAbort= (SOFT) Abort Type. When SOFT, simply writes an err
message to the log.
Set to any other value to call mf_abort (which can be configured to abort in
various fashions according to context).
@@ -58,8 +59,14 @@
%goto exit_success;
%exit_err:
%if &mAbort=SOFT %then %put %str(ERR)OR: &abortmsg;
%else %mf_abort(mac=mf_verifymacvars,type=&mabort,msg=&abortmsg);
%put %str(ERR)OR: &abortmsg;
%mf_abort(iftrue=(&mabort ne SOFT),
mac=mf_verifymacvars,
msg=%str(&abortmsg)
)
0
%return;
%exit_success:
1
%mend mf_verifymacvars;

View File

@@ -0,0 +1,22 @@
/**
@file
@brief Testing mf_verifymacvars macro
<h4> SAS Macros </h4>
@li mf_verifymacvars.sas
@li mp_assert.sas
@li mp_assertscope.sas
**/
%let var1=x;
%let var2=y;
%mp_assertscope(SNAPSHOT)
%mp_assert(
iftrue=(%mf_verifymacvars(var1 var2)=1),
desc=Checking macvars exist,
outds=work.test_results
)
%mp_assertscope(COMPARE)