Macros for SAS Application Developers
https://github.com/sasjs/core
mcf_length.test.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Testing mcf_length.sas macro
4 
5  <h4> SAS Macros </h4>
6  @li mcf_length.sas
7  @li mp_assert.sas
8 
9 **/
10 
11 %mcf_length(wrap=YES, insert_cmplib=YES)
12 
13 data test;
14  call symputx('null',mcf_length(.));
15  call symputx('special',mcf_length(._));
16  call symputx('three',mcf_length(1));
17  call symputx('four',mcf_length(10000000));
18  call symputx('five',mcf_length(12345678));
19  call symputx('six',mcf_length(1234567890));
20  call symputx('seven',mcf_length(12345678901234));
21  call symputx('eight',mcf_length(12345678901234567));
22 run;
23 
24 %mp_assert(
25  iftrue=(%str(&null)=%str(0)),
26  desc=Check if NULL returns 0
27 )
28 %mp_assert(
29  iftrue=(%str(&special)=%str(3)),
30  desc=Check if special missing ._ returns 3
31 )
32 %mp_assert(
33  iftrue=(%str(&three)=%str(3)),
34  desc=Check for length 3
35 )
36 %mp_assert(
37  iftrue=(%str(&four)=%str(4)),
38  desc=Check for length 4
39 )
40 %mp_assert(
41  iftrue=(%str(&five)=%str(5)),
42  desc=Check for length 5
43 )
44 %mp_assert(
45  iftrue=(%str(&six)=%str(6)),
46  desc=Check for length 6
47 )
48 %mp_assert(
49  iftrue=(%str(&seven)=%str(7)),
50  desc=Check for length 3
51 )
52 %mp_assert(
53  iftrue=(%str(&eight)=%str(8)),
54  desc=Check for length 8
55 )
56 %mp_assert(
57  iftrue=(&syscc=0),
58  desc=Check syscc=0 before re-initialisation
59 )
60 
61 /* test 2 - compile again test for warnings */
62 %mcf_length(wrap=YES, insert_cmplib=YES)
63 
64 %mp_assert(
65  iftrue=(&syscc=0),
66  desc=Check syscc=0 after re-initialisation
67 )