Hi, New to the forum. I'm facing an issue when executing the following data step (Using SAS Viya 4): data GEN_Reports_®ion.;
set GEN_Folders_®ion.; /* Start with the existing filenames dataset */
length region $10 plant $4 report $200 fparent $200 folderpath $500 fullpath $500 description $500;
/* Check if the entry is a folder */
region="®ion.";
rc = filename('dirrf', '', 'FILESRVC', cats("folderpath='", fullpath, "'"));
did = dopen('dirrf');
if did > 0 then do; /* If it's a folder, explore its contents */
folderpath = fullpath; /* Update folderpath to the current folder */
do i = 1 to dnum(did);
report = dread(did, i); /* File or subfolder name */
fullpath = cats(folderpath, "/", report);
/* Check if it's another subfolder */
rc_sub = filename('checksub', '', 'FILESRVC', cats("folderpath='", fullpath, "'"));
did_sub = dopen('checksub');
if did_sub > 0 then do; /* It's a subfolder */
/*fparent = folderpath;
output;*/
did_sub = dclose(did_sub);
end;
else do; /* It's a file */
fparent = folderpath;
fc= filename('filrf','','FILESRVC',cats("folderpath='", fparent, "' filename='", report, "'"));
fid=fopen('filrf');
optval=finfo(fid,'File Identifier');
description=finfo(fid,'Description');
hyperlink=cats('https://****/SASVisualAnalytics/?reportUri=/reports/reports/',optval,'&reportViewOnly=true&sas-welcome=false');
fid=fclose(fid);
fc= filename('filrf');
*output; /* Save the file information */
end;
rc_sub = filename('checksub');
end;
did = dclose(did);
end;
rc= filename('dirrf');
keep region plant report folderpath fullpath optval hyperlink description;
run; What the data step is trying to accomplish is to list all VA reports in the subfolders (representing different locations my company) of a folder (defined by the macro ®ion). The thing is that, if I run this step in isolation it will successfully generate the table but the logs will show the following message: NOTE: The SAS System stopped processing this step because of errors. NOTE: There were 5 observations read from the data set WORK.GEN_FOLDERS_REU. WARNING: The data set WORK.GEN_REPORTS_REU may be incomplete. When this step was stopped there were 5 observations and 8 variables. WARNING: Data set WORK.GEN_REPORTS_REU was not replaced because this step was stopped. I've been completely unable to find out what those "because of errors" mean. I've run it in debug and it generates no error. I'm almost sure that I'm closing all the file and directory references. Any Idea?
... View more