Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_aligndecimal.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mp_aligndecimal macro
4 @details Creates an aligned variable and checks the number of leading blanks
5
6 <h4> SAS Macros </h4>
7 @li mp_aligndecimal.sas
8 @li mp_assertcolvals.sas
9 @li mp_assertscope.sas
10
11**/
12
13
14
15/* target values */
16data work.checkds;
17 do checkval=' 0.56',' 123.45',' 123.4 ',' 1.2 ',' 0';
18 output;
19 end;
20run;
21
22/* raw values */
23data work.rawds;
24 set work.checkds;
25 tgtvar=cats(checkval);
26 drop checkval;
27run;
28%mp_assertcolvals(work.rawds.tgtvar,
29 checkvals=work.checkds.checkval,
30 desc=No values match (ready to align),
31 test=NOVAL
32)
33
34/* aligned values */
35%mp_assertscope(SNAPSHOT)
36data work.finalds;
37 set work.rawds;
38 %mp_aligndecimal(tgtvar,width=4)
39run;
40%mp_assertscope(COMPARE)
41
42%mp_assertcolvals(work.finalds.tgtvar,
43 checkvals=work.checkds.checkval,
44 desc=All values match (aligned),
45 test=ALLVALS
46)