BookmarkSubscribeRSS Feed
Quartz | Level 8

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);
did = dclose(did);
did = filename(fref);
keep fname;

Trying to adapt it to accept something like:

%let folder = \\\share$\Wes\Data;

Super User Tom
Super User

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  \\\share to some Unix path such as /mnt/ 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 \\\share$\Wes\Data as /sas/data/Wes_Data/;



Talk to you system team to see if they can help you get them mapped.


Quartz | Level 8

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.

Super User Tom
Super User

@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:

  • Generate the list on your PC and upload the list to Unix so SAS can read it.
  • Have your SAS session signon to some other machine that has access to the share and generate the list of files and copy it back to the machine where SAS is running so it can read.



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. 

Register now!

From SAS Users blog
Want more? Visit our blog for more articles like these.
5 Steps to Your First Analytics Project Using SAS

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.

Discussion stats
  • 4 replies
  • 3 in conversation