Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_applyformats.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mp_applyformats.sas macro
4
5 <h4> SAS Macros </h4>
6 @li mf_getvarformat.sas
7 @li mp_applyformats.sas
8 @li mp_assert.sas
9 @li mp_getcols.sas
10
11**/
12
13/**
14 * Test 1 Base case
15 */
16
17data work.example;
18 set sashelp.prdsale;
19 format _all_;
20run;
21%let origfmt=%mf_getvarformat(work.example,month);
22
23%mp_getcols(sashelp.prdsale,outds=work.cols)
24
25data work.cols2;
26 set work.cols;
27 lib='WORK';
28 ds='EXAMPLE';
29 var=name;
30 fmt=format;
31 keep lib ds var fmt;
32run;
33
34%mp_applyformats(work.cols2)
35
36%mp_assert(
37 iftrue=("&origfmt"=""),
38 desc=Check that formats were cleared,
39 outds=work.test_results
40)
41%mp_assert(
42 iftrue=("%mf_getvarformat(work.example,month)"="MONNAME3."),
43 desc=Check that formats were applied,
44 outds=work.test_results
45)