Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_updatevarlength.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mp_updatevarlength macro
4
5 <h4> SAS Macros </h4>
6 @li mp_updatevarlength.sas
7 @li mf_getvarlen.sas
8 @li mp_assert.sas
9
10**/
11
12data work.len_update;
13 length a $1 b $2;
14 a='1';
15 b='12';
16run;
17
18%mp_updatevarlength(work.len_update,a,3)
19
20%mp_assert(
21 iftrue=(%mf_getvarlen(work.len_update,a)=3),
22 desc=Checking that the variable is widened to the requested length,
23 outds=work.test_results
24)
25
26proc sql noprint;
27 select a into: val from work.len_update;
28quit;
29
30%mp_assert(
31 iftrue=(%sysfunc(strip(&val))=1),
32 desc=Checking that the stored value survives the length change,
33 outds=work.test_results
34)
35
36/* a request for the length it already has must return quietly */
37%mp_updatevarlength(work.len_update,a,3)
38%mp_assert(
39 iftrue=(&syscc=0),
40 desc=Checking that an unchanged length is a no-op,
41 outds=work.test_results
42)