I'm running in linux and I'm trying to parse a number of rows formatted as follows (file name and directory structure will be variable) 06/16/17 09:40:19.8344320410 /workspace/alphabuilder/data-jp/D160125.DB The goal from this example is a data set where each record includes Date = 06/16/17 Time =09:40:19.83 File = D160125.DB Folder = /workspace/alphabuilder/data-jp/ My Sas code /*Test varaibles*/ %let folder = /workspace/uat/card2/ai/x796785/V_drive/alphabuilder/data-jp/ ; %let prefix = M ; %let suffix = db ; Filename dirlist pipe "find &folder. -iname &prefix.*&suffix. -printf '%TD %TT %p\n'"; Data &outlist (keep=folder filename date time); Infile dirlist end=last; format date mmddyy10. time time8.; input; *Create the folder= file directory location; date = input(_infile_,mmddyy10.); time = input(substr(_infile_,10,18),time8.); filename = substr(_infile_,length(_infile_) - index(reverse(_infile_),"/") + 2,length(_infile_)); folder = substr(_infile_,29,length(_infile_)- index(reverse(_infile_),"/") ); Run; My problem: Folder includes the filename at the end /workspace/alphabuilder/data-jp/D160125.DB I tried a number of variations including folder = substr(_infile_,29,length(_infile_)- 5 ); folder = substr(_infile_,29,35 ); I'm sure this is a rookie issue but I haven't been able to google a solution.
... View more