1
0
mirror of https://github.com/sasjs/core.git synced 2026-01-04 08:00:05 +00:00

Merge pull request #95 from sasjs/dirlist_enhancement

feat: Recursive Directory Listing
This commit is contained in:
Allan Bowe
2021-11-26 13:00:15 +00:00
committed by GitHub
3 changed files with 172 additions and 36 deletions

View File

@@ -0,0 +1,50 @@
/**
@file
@brief Testing mp_ds2cards.sas macro
<h4> SAS Macros </h4>
@li mf_nobs.sas
@li mf_mkdir.sas
@li mp_dirlist.sas
@li mp_assert.sas
**/
/**
* make a directory structure
*/
%let root=%sysfunc(pathname(work))/top;
%mf_mkdir(&root)
%mf_mkdir(&root/a)
%mf_mkdir(&root/b)
%mf_mkdir(&root/a/d)
%mf_mkdir(&root/a/e)
%mf_mkdir(&root/a/e/f)
data "&root/a/e/f/ds1.sas7bdat";
x=1;
run;
%mp_dirlist(path=&root, outds=myTable, maxdepth=MAX)
%mp_assert(
iftrue=(%mf_nobs(work.mytable)=6),
desc=All levels returned,
outds=work.test_results
)
%mp_dirlist(path=&root, outds=myTable2, maxdepth=2)
%mp_assert(
iftrue=(%mf_nobs(work.mytable2)=5),
desc=Top two levels returned,
outds=work.test_results
)
%mp_dirlist(path=&root, outds=myTable3, maxdepth=0)
%mp_assert(
iftrue=(%mf_nobs(work.mytable3)=2),
desc=Top level returned,
outds=work.test_results
)