Hi there,
My task is to list out all files in my current directory which has about 3 sub directories . As we have EG , all pipe commands are disabled but I am able to list out all file names in a dataset by using following code but however I am unable to tweak it for all sub folders as these 3 subdirectories also have 4 folders each. Basically its Q1, Q2 and Q3 and then Q1 consists of folders of January, February and so on .... Need help in modifying this code to take care of all folders....or else if any alternative is there without pipes..plz let me know
_' );
filename _folder_ "%bquote(\\jafiles01\SAS Folder\)";
data filenames(keep=memname);
handle=dopen( '_folder
if handle > 0 then do;
count=dnum(handle);
do i=1 to count;
memname=dread(handle,i);
output filenames;
end;
end;
rc=dclose(handle);
run;
filename _folder_ clear;
You might want to check this out as well:
Thanks SASKiwi for the link but it still does the same thing. It reads out files from same folder and not the subfolders....
What OS are you using?
I am using Windows with SAS Enterprise Guide 4.3
Is the server you are connecting to through EG also Windows?
Take a look at Jason Secosky's excellent paper "User-Written DATA Step Functions." Specifically, look at the "directory traversal example." I would include a link but copy/paste doesn't work for me in this forum.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.