使用read.ssd将SAS数据集转换为R data.frame

时间:2012-11-13 10:22:32

标签: r sas

我希望从Windows中的SAS数据集中将数据读入R. read.ssd函数允许我这样做,但是,当我尝试导入名称中包含任何非字母符号的SAS数据集时,它似乎有问题。例如,我可以使用以下内容导入table.sas7bdat

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

但我不能对名为table1.sas7bdat的表SAS数据集执行相同的操作。它返回一个错误:

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

鉴于我没有重命名这些数据集的选项,有没有办法读取名称中包含非字母符号的SAS数据集?

2 个答案:

答案 0 :(得分:0)

看来,其他人看起来也有问题。也许这只是一个错误。

无论如何,试试这个(旧的)R帮助帖子的建议,由古老的Dan Nordlund发布,他非常擅长这些东西 - 如果你想尝试交叉,还可以在SASL(sasl@listserv.uga.edu)上活动 - 在那里提出你的问题。 https://stat.ethz.ch/pipermail/r-help/2008-December/181616.html

另外,如果你不介意8个字符的长变量名,你可以考虑传输方法。

答案 1 :(得分:0)

使用:

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"))