Macros for SAS Application Developers
https://github.com/sasjs/core
mp_appendfile.test.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Testing mp_appendfile.sas macro
4 
5  <h4> SAS Macros </h4>
6  @li mp_appendfile.sas
7  @li mp_assert.sas
8 
9 **/
10 
11 
12 filename tmp1 temp;
13 filename tmp2 temp;
14 filename tmp3 temp;
15 data _null_; file tmp1; put 'base file';
16 data _null_; file tmp2; put 'append1';
17 data _null_; file tmp3; put 'append2';
18 run;
19 %mp_appendfile(baseref=tmp1, appendrefs=tmp2 tmp3)
20 data _null_;
21  infile tmp1;
22  input;
23  put _infile_;
24  call symputx(cats('check',_n_),_infile_);
25 run;
26 %global check1 check2 check3;
27 %mp_assert(
28  iftrue=("&check1"="base file"),
29  desc=Line 1 of file tmp1 is correct,
30  outds=work.test_results
31 )
32 %mp_assert(
33  iftrue=("&check2"="append1"),
34  desc=Line 2 of file tmp1 is correct,
35  outds=work.test_results
36 )
37 %mp_assert(
38  iftrue=("&check3"="append2"),
39  desc=Line 3 of file tmp1 is correct,
40  outds=work.test_results
41 )