BookmarkSubscribeRSS Feed
ProcWes
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);
  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;

4 REPLIES 4
Tom
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  \\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.

 

ProcWes
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.

Tom
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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 4 replies
  • 1048 views
  • 0 likes
  • 3 in conversation