Hi, I am new SAS user. I am using SAS online demand version. I would like list all files from folder/subfolder. I tried below code but am neither am getting output nor error. Could you please help me data yfiles;
keep filename;
length fref $8 filename $80;
rc = filename(fref, 'path of folder/subfolder');
if rc = 0 then
do;
did = dopen(fref);
rc = filename(fref);
end;
else
do;
length msg $200.;
msg = sysmsg();
put msg=;
did = .;
end;
if did <= 0
then
putlog 'ERR' 'OR: Unable to open directory.';
dnum = dnum(did);
do i = 1 to dnum;
filename = dread(did, i);
/* If this entry is a file, then output. */
fid = mopen(did, filename);
if fid > 0
then
output;
end;
rc = dclose(did);
run;
proc print data=yfiles;
run;
... View more