options msglevel=i;
libname in1 "/sascommon/sasusers/ksnm843";
%let subdir=/sascommon/gridnode01/config/Lev1/SASApp94/WorkspaceServer/RTRACE_LOGS;
data work.dirlist(keep=filename strUser ModDT CrDT strPID strSource);
/* must be explicitly set to blank to have the filename function generate a fileref */
fileref = ' ';
rc = filename(fileref,"&subdir");
/* open fileref and loop throughfilenames */
did=dopen(fileref);
do i = 1 to dnum(did);
/* extract filename */
fileName = dread(did,i);
/* find the position of PID in the filename */
pid_start = index(fileName,"PID")+3;
/* find the end position of PIF in filename */
pid_end = index(fileName,"DATE")-1;
/* extract PID */
strPID = substr(fileName,pid_start,pid_end - pid_start);
/* find the start of DATE in filename */
date_start = index(fileName,"DATE")+4;
/* find the end position of DATE in the filename */
date_end = index(fileName,":")-1;
/* set the start of the time field */
time_start = date_end +2;
/* find the end of the time field */
time_end = index(filename,".");
/* extract creation time */
tmpTime = Trim(substr(filename, time_start, time_end - time_start));
tmpHour = Substr(tmpTime,1, 2)*1;
tmpMin = Substr(tmpTime,3,2)*1;
tmpSec = Substr(tmpTime,5,2)*1;
/* extract creation date */
strDT = trim(substr(fileName,date_start,date_end - (date_start-1)));
tmpDT = input(put(strDT,8.),yymmdd8.);
CrDt = DHMS(put(tmpDT,8.),tmpHour,tmpMin,tmpSec);
fid = mopen(did,fileName);
infonum=foptnum(fid);
if fid then do;
/* extract userid */
strUser=finfo(fid, foptname(fid, 2));
/* extract file modified date */
ModDT=input(trim(finfo(fid, foptname(fid, 5))),datetime20.);
format ModDT CrDT datetime20.;
/* extract file location */
strSource = finfo(fid, foptname(fid, 1));
output;
end;
end;
rc = dclose(did);
rc = filename(fileref);
run; I got the following error when I executed the above mentioned program ERROR: Invalid DO loop control information, either the INITIAL or TO expression is missing or the BY expression is missing, zero, or invalid. I have also attached the detailed log Please help me resolve this error
... View more