It would be fairly easy to adapt that macro code to work within a tagset.
An event with the same functionality of the macro could recursively trigger
itself when a directory is found.
I seem to recall that the maximum recursion depth is 200. That should
be plenty deep enough.
There are various examples of using data step functions in tagsets at
http://support.sas.com/rnd/base/topics/odsmarkup/tagsets.html
Here's an example of recursion in a tagset.
/*---------------------------------------------------------------eric-*/
/*-- Recursion limit is 200. If the limit is hit it will unwind --*/
/*-- automatically. --*/
/*------------------------------------------------------------12Feb03-*/
proc template;
define tagset tagsets.test;
define event doc;
set $count 1;
trigger loop;
put "Count: " $count nl;
end;
define event loop;
put "Count: " $count nl;
putlog "Count: " $count;
eval $count $count+1;
trigger loop /if $count<100;
eval $count $count-1;
put "Unwind:" $count nl;
putlog "Unwind:" $count;
end;
end;
run;
ods tagsets.test file="recurse.txt";
ods _all_ close;