谁能帮我写一个 R 数据框作为 SAS 数据集? [英] Can anyone help me write a R data frame as a SAS data set?

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

问题描述

在 R 中,我使用了 foreign 库中的 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 用户,但我之前用过 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天全站免登陆