Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_tree.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mp_tree macro
4
5 <h4> SAS Macros </h4>
6 @li mp_tree.sas
7 @li mf_mkdir.sas
8 @li mp_assert.sas
9
10**/
11
12%let root=%sysfunc(pathname(work))/tree_test;
13%mf_mkdir(&root/sub)
14
15data _null_;
16 file "&root/one.txt";
17 put 'first';
18run;
19
20data _null_;
21 file "&root/sub/two.txt";
22 put 'second';
23run;
24
25%mp_tree(dir=&root,outds=work.tree_out)
26
27proc sql noprint;
28 select count(*) into: n_files from work.tree_out
29 where index(fullpath,'one.txt')>0;
30 select count(*) into: n_nested from work.tree_out
31 where index(fullpath,'two.txt')>0;
32quit;
33
34%mp_assert(
35 iftrue=(&n_files=1),
36 desc=Checking that a file in the root of the tree is found,
37 outds=work.test_results
38)
39
40%mp_assert(
41 iftrue=(&n_nested=1),
42 desc=Checking that a file in a subfolder is found,
43 outds=work.test_results
44)