Well, that's a bit another task than I thought so far...
The code below scans all the directories and subdirectories (that's the /S switch) and looks for files that have the pattern "SMS-&LogDate..log".
The matching filenames (fully qualified; path & filename) are stored in the variable LogFiles and written to the SAS ds DIRLIST.
The second datastep is reading all the matching logfiles (as stored in the ds DIRLIST) and writing the information to the ds SMS_Logs_&LogDate -> There will be one ds per LogDate.
You might not know the technique used. The critical part is the infile statement with filevar= and end=.
Here some more information:
http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000146932.htm
http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000146932.htm#a000177201
Let me know if that worked.
HTH
Patrick
/* %let LogDate=%sysfunc(today(),yymmddN8.); */
%let LogDate=20080311;
%let path=D:\SMSGatewayData2\USERS\SMS-&LogDate..log;
filename DIRLIST pipe "dir ""&path""/A-D-h-s/B/S";
data dirlist ;
length LogFiles $256;
infile dirlist length=reclen ;
input LogFiles $varying256. reclen;
run ;
filename DIRLIST clear;
data SMS_Logs_&LogDate;
set dirlist;
infile dummy filevar=LogFiles end=done pad missover lrecl=128;
LogFileWithPath=LogFiles;
User=scan(LogFiles,-2,'\');
LogFile=scan(LogFiles,-1,'\');
do while(not done);
input @1 LogLine $char128.;
output;
end;
run;
Message was edited by: Patrick