Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_copyfolder.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mp_copyfolder.sas macro
4
5 <h4> SAS Macros </h4>
6 @li mp_copyfolder.sas
7 @li mf_mkdir.sas
8 @li mf_nobs.sas
9 @li mp_assert.sas
10 @li mp_dirlist.sas
11
12**/
13
14/**
15 * make a directory structure
16 */
17
18%let root=%sysfunc(pathname(work))/top;
19%mf_mkdir(&root)
20%mf_mkdir(&root/a)
21%mf_mkdir(&root/b)
22%mf_mkdir(&root/a/d)
23%mf_mkdir(&root/a/e)
24%mf_mkdir(&root/a/e/f)
25data "&root/a/e/f/ds1.sas7bdat";x=1;
26data "&root/a/e/ds2.sas7bdat";x=1;
27data "&root/a/ds3.sas7bdat";x=1;
28run;
29
30%mp_dirlist(path=&root, outds=myTable, maxdepth=MAX)
31
32%mp_assert(
33 iftrue=(%mf_nobs(work.mytable)=8),
34 desc=Temp data successfully created,
35 outds=work.test_results
36)
37
38/**
39 * copy it
40 */
41%let newfolder=%sysfunc(pathname(work))/new;
42%mp_copyfolder(&root,&newfolder)
43
44%mp_dirlist(path=&newfolder, outds=work.myTable2, maxdepth=MAX)
45
46%mp_assert(
47 iftrue=(%mf_nobs(work.mytable2)=8),
48 desc=Folder successfully copied,
49 outds=work.test_results
50)
51
52