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:
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.
Find more tutorials on the SAS Users YouTube channel.