I presume you know what command will list your file system hierarchy as you show in the posting. That is the command whose output a data step can read and parse
roam through support.sas.com for examples and samples of
filename pipe (see
http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/viewer.htm#pipe.htm )
function scan()
(for example
filename = scan( data, -2, '. ' ) ;
would use delimiters dot and blank, to extract the second last string from string "data" .
filename files_l pipe "your command" ;
data your_data_with_filenames ;
length filename $200 ;
infile files_l truncover ;
input ;
if scan( _infile_, -1, '. ' ) ='log' ;
* ignoring lines which do not finish "log" ;
filename = scan( _infile_, -2, '. ' ) ;
run;