I am on SAS Grid, Linux installation. I have used this code before to get a list of all of the files in a directory. However, today I have a folder that's on a Windows server and I am wondering if there is a way to adapt this code to this problem. What I mostly would need is a way to specify the server to go to.
%let folder = /sas/data/Risk_Mgmt/; /*Get list of files in txt folder*/ data gl_txts; length fref $8 fname $200; did = filename(fref,"&folder."); did = dopen(fref); do i = 1 to dnum(did); fname = dread(did,i); output; end; did = dclose(did); did = filename(fref); keep fname; run;
Trying to adapt it to accept something like:
%let folder = \\server.com\share$\Wes\Data;
The Windows server's resource needs to be mounted in the Linux file system for this to work. Talk to your SAS server administrator.
Since SAS is running on Unix to see the Windows share you would need to mount it to the Unix filesystem.
You could map the top level of the share \\server.com\share to some Unix path such as /mnt/server.com/share or what ever naming convention your Unix shop wants to use.
Or you could mount just some sub-directory of the Windows share to to a path on Unix instead. Perhaps you might want them to mount \\server.com\share$\Wes\Data as /sas/data/Wes_Data/;
Talk to you system team to see if they can help you get them mapped.
I was hopeful that since I'm not trying to copy or move the files, that I would be able to just list them somehow. Open to any ideas.
@ProcWes wrote:
I was hopeful that since I'm not trying to copy or move the files, that I would be able to just list them somehow. Open to any ideas.
You have to access the disk to read the list of files, whether or not you read the files themselves.
Other methods:
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.