1
0
mirror of https://github.com/sasjs/core.git synced 2026-01-03 15:40:05 +00:00

feat: new mp_aligndecimal macro

Includes a test, and an update to the mp_assertcolvals test to include a new test type (NOVAL)
This commit is contained in:
Allan
2023-06-19 23:54:18 +01:00
parent a2c7bdafb4
commit 9887efcf60
3 changed files with 143 additions and 1 deletions

View File

@@ -0,0 +1,44 @@
/**
@file
@brief Testing mp_aligndecimal macro
@details Creates an aligned variable and checks the number of leading blanks
<h4> SAS Macros </h4>
@li mp_aligndecimal.sas
@li mp_assertcolvals.sas
**/
/* target values */
data work.checkds;
do checkval='1234.56',' 123.45',' 123.4 ',' 1.2 ',' 0';
output;
end;
run;
/* raw values */
data work.rawds;
set work.checkds;
tgtvar=cats(checkval);
drop checkval;
run;
%mp_assertcolvals(work.rawds.tgtvar,
checkvals=work.checkds.checkval,
desc=No values match (ready to align),
test=NOVAL
)
/* aligned values */
data work.finalds;
set work.rawds;
%mp_aligndecimal(tgtvar,width=4)
run;
%mp_assertcolvals(work.finalds.tgtvar,
checkvals=work.checkds.checkval,
desc=All values match (aligned),
test=ALLVALS
)