How to read a SAS dataset which is hosted on a Unix Server

Hello, I am trying to read a SAS dataset which is hosted on a Unix server and the script below does not work.
It work fine when the dataset is located a my C drive but not a the Unix server. I would like to able to read a SAS dataset on a Unix Server directly because file transfer on my c drive will cause safety issue.

Class <- read.sas7bdat("//finsys/bicoe/test/class.7bdat")

I'm not sure the issue is with the function but specifying the path. If you do ls("//finsys/bicoe/test"), is the file shown? If not, you're not specifying the folder path correctly.

Hello Stephanie,

I am new to the usage of R language. Also, the difficulty I am facing, is that R is installed on my window based computer while my SAS file is hosted on a UNIX server.

I will need to find a way to permit R to communicate with my Unix server.

Maybe something like that:

handle <- new_handle()
handle_setopt(handle, username = "domain\username")
handle_setopt(handle, password = "secret") # If needed
request <- curl_fetch_memory("smb://", handle = handle)
contents <- rawToChar(request$content)

But it is not clear for me how to make the ls command as you have suggested and from there read the sas file

Hello, I have made some progress. I am now able to connect to our unix server using ssh_connect. Also, I am able to get the files list using this command:


But the next step will be to be able to read the sas dataset.
How do we do that? Do I need absolutely to copy the sas file from the unix server to my windows server ? Is it possible to read it directly on the unix server without making a copy of it ?

Is it possible to change the working directory and if so how.

I would suggest the following approach:

  1. Find out the IP Address or hostname of your windows machine (e.g.
  2. Find out the full path where your SAS datasets are stored (e.g. /finsys/bicoe/test). This will become your share-name.
  3. Make sure the NFS server on the UNIX server is running
  4. Add a new line to the file /etc/exports on the UNIX server where you write

The above line will export the folder to your windows machine read-only(ro) to prevent accidental changes to the SAS data sets (if undesired, change ro to rw for read-write)

  1. Re-export all the NFS file systems including the new ones via
exportfs -aR 
  1. Mount NFS share on your windows machine following Network File System (NFS): Mount an NFS Share on Windows | IT@UMN | The people behind the technology


  • Steps 2 to 4 will need admin privileges on the UNIX server
  • Alternatives to the above approach would be to use
    * CIFS/SMB
    * fuse-sshfs (GitHub - winfsp/sshfs-win: SSHFS For Windows) - relies on ssh connection to the UNIX server

Happy to discuss more as needed.


Hello Michael,

Steps 0, 1 and 2 are clear, but I don't understand what is required in step 3 (add a new line to the file / tec/reports on the Unix server where you write

/finsys/bicoe/test 1988.168.0.19(ro) ?

I though that we need to send instruction through Microsoft R Open

I am able to read the sas file on my drive P (windows server)

class2 <-read.sas7bdat("P:/TEST/FILE1684/class.sas7bdat")

I am not able to do the same task in Microsoft R Open via our unix sever.
Do we really need to export the data on the window server ?

I would prefer to connect via ssh protocol then do the same task as for the P Drive.
Is it possible to do that and if so how ?

I am returning on this project, ie. trying to read a sas dataset in R.
I am now able to connect to our unix server using ssh_connect . However, it seems that I am not able to read the sas data file because my working directory is mapped to a location on the c drive. Is there a way to set my working directory to servername//finsys/bicoe/users/etc.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.