I had half anticipated what you wanted, and loaded the physical names - then released CODEDIR Either you you remove the last call execute() statement call execute( 'FILENAME CODEDIR ;' ); * to release the fileref ; or adapt your data step. CODEDIR returns the bare path and filename. The following code works onn WIN and UNIX platforms, but not on zOS and probably not on VMS I would suggest you adapt your process. Parsing the lines returned by CODEDIR might be easier with the scan() function filename = scan( line, -1, '/\' ) ; * neither / not \ will appear in filenames you are concerned about; filetype = scan( filename, -1, '.' ) ; if filetype = 'sas7bdat' then SAS_ds_name = upcase( scan( filename, 1, '.' )) ; else if lowcase(filetype) = 'sas' then prog_name = filename ; not sure why you identify sas7bdat and then ignore them.. data ds_and_progs ; set filelist ; length filename $100 filetype $8 prog_name $40 sas_ds_name $32 filepath $1000; filename = scan( line, -1, '/\' ) ; * neither / not \ will appear in filenames you are concerned about; filetype = scan( filename, -1, '.' ) ; if filetype = 'sas7bdat' then SAS_ds_name = upcase( scan( filename, 1, '.' )) ; else if lowcase(filetype) = 'sas' then prog_name = filename ; else delete ; filepath = substr( line, 1, length(line) - length( filename) -1 ) ; run ; . pick the results you want
... View more