2
votes

I wish to read data into R from SAS data sets in Windows. The read.ssd function allows me to do so, however, it seems to have an issue when I try to import a SAS data set that has any non-alphabetic symbols in its name. For example, I can import table.sas7bdat using the following:

directory <- "C:/sas data sets"
sashome <- "/Program Files/SAS/SAS 9.1"
table.df <- read.ssd(directory, "table", sascmd = file.path(sashome, "sas.exe"))

but I can't do the same for a table SAS data set named table1.sas7bdat. It returns an error:

Error in file.symlink(oldPath, linkPath) : 
symbolic links are not supported on this version of Windows 

Given that I do not have the option to rename these data sets, is there a way to read a SAS data set that has non-alphabetic symbols in its name in to R?

2
Have you checked if the file table1.sas7bat is not a symbolic link? - Paul Hiemstra
Double check that you have the extension right. SAS datasets are normally .sas7bdat not .sas7bat. - Joe
@Paul Hiemstra - I do not believe that it is a symbolic link. I used a SAS data step to create "table1" from "table":<br> libname dir "C:/sas data sets";<br> data dir.table1;<br> set dir.table;<br> run;<br> As such, the only difference is that the second data set has a non-alphabetic character in its name. I assume that this must be the cause of the issue. - josh
Hmm, clearly that is not how I am meant to write code in a comment... - josh
@Joe, my file extensions are definitely .sas7bdat. I shall edit. - josh

2 Answers

0
votes

Looking about, it looks like others have your problem as well. Perhaps it's just a bug.

Anyway, try the suggestion from this (old) R help post, posted by the venerable Dan Nordlund who's pretty good at this stuff - and also active on SASL ([email protected]) if you want to try cross-posting your question there. https://stat.ethz.ch/pipermail/r-help/2008-December/181616.html

Also, you might consider the transport method if you don't mind 8 character long variable names.

0
votes

Use:

directory <- "C:/sas data sets"
sashome <- "/Program Files/SAS/SAS 9.1"
table.df <- read.ssd(library=directory, mem="table1", formats=F,
sasprog=file.path(sashome, "sas.exe"))