任何人都可以帮我写一个R数据帧作为SAS数据集? [英] Can anyone help me write a R data frame as a SAS data set?

查看:169
本文介绍了任何人都可以帮我写一个R数据帧作为SAS数据集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在R中,我使用外部库中的 write.foreign()函数,以将数据帧写入SAS数据集。

In R, I have used the write.foreign() function from the foreign library in order to write a data frame as a SAS data set.

write.foreign(df = test.df, datafile = 'test.sas7bdat', codefile = 'test.txt', package = "SAS")

SAS数据文件被写入,但是当我尝试在SAS Viewer 9.1中打开它(Windows XP),我收到以下消息 - 不支持SAS数据集文件格式。

The SAS data file is written, but when I try to open it in SAS Viewer 9.1 (Windows XP), I receive the following message - "SAS Data set file format is not supported".

注意:我通常不熟悉SAS,所以如果一个答案存在这是常规SAS用户已知的,请原谅我的无知。

Note: I am generally unfamiliar with SAS, so if an answer exists that would have been known by a regular SAS user, please excuse my ignorance.

推荐答案

我不是一个SAS用户,但我已经使用$ code> write.xport()之前,它的工作正常。我粗暴的理解是有两种类型的SAS文件,内部文件和XPORT文件。 XPORT是在不同版本,架构等之间更兼容的。

I'm not much of a SAS user either, but I've used write.xport() before and it's worked fine. My crude understanding is that there are two types of SAS files, internal ones and XPORT files. The XPORT ones are the ones that are more compatible across different versions, architectures, etc.

这篇关于任何人都可以帮我写一个R数据帧作为SAS数据集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆