3

R 与 SAS 的集成

 2 years ago
source link: https://cosx.org/2013/02/integrating-sas-with-r/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

R 与 SAS 的集成

关键词:R 语言; SAS; 集成

一、为什么 R 与 SAS 要集成?

一位优秀的分析师不仅要有深厚的理论功底、丰富的实战经验,还要熟悉几款常用的分析软件,并有一款自己精通的软件。就像武林高手既有独门秘器,又要熟悉各门各派,这样才能博采众长,兼收并蓄,为己所用。

竞争促进创新,合作带来双赢。R 与 SAS 各有优势,也各有问题,国内外网上骂战得多,思考如何将两者集成并能拿出可行方案的人则少之又少,即便有也基本都是老外或者外籍华人想出来的。这里不想贬低国人,只想建议大家多一些独创和研究精神。

有人会问,为何要集成?这里引用网上一位作者给出的观点,虽是一面之词,但不妨参考,有些观点还是比较中肯的。   > I work in an environment dominated by SAS, and I am looking to integrate R into our environment. > > Why would I want to do such a thing? First, I do not want to get rid of SAS. That would not only take away most of our investment in SAS training and hiring good quality SAS programmers, but it would also remove the advantages of SAS from our environment. These advantages include the following: > > •Many years of collective experience in pharmaceutical data management, analysis, and reporting >
> •Workflow that is second to none (with the exception of reproducible research, where R excels) >
> •Reporting tools based on ODS that are second to none >
> •SAS has much better validation tools than R, unless you get a commercial version of R (which makes IT folks happy) >
> •SAS automatically does parallel processing for several common functions > > So, if SAS is so great, why do I want R? > > •SAS’s pricing model makes it so that if I get a package that does everything I want, I pay thousands of dollars per year more than the basic package and end up with a system that does way more than I need. For example, if I want to do a CART analysis, I have to buy Enterprise Miner, which does way more than I would need. >
> •R is more agile and flexible than SAS >
> •R more easily integrates with Fortran and C++ than SAS (I’ve tried the SAS integration with DLLs, and it’s doable, but hard) >
> •R is better at custom algorithms than SAS, unless you delve into the world of IML (which is sometimes a good solution).

原文地址:http://www.r-bloggers.com/integrating-r-into-a-sas-shop/

二、集成的方式有哪些?

R 与 SAS 的集成方式主要有以下几种:

1)SAS 官方的支持:通过 SAS/IML 在 SAS 里面提交 R 代码

  • 因为 R 代码本质上是在 R 里运行,所以全面支持 R 的各种模型和函数。
  • 支持 32 位或 64 位的 Windows、Linux 操作系统
  • 数据交换、错误捕获等方面表现不错,支持 SAS Format(关于 Format 是从资料上看到的,我没验证这个)。
  • 需要购买 SAS/IML(9.22 版本或更高版本),成本高

2)SAS 官方的支持:通过 SAS Model Manager 将 R 模型导出生成的 PMML 文件翻译成 SAS 代码

  • 可以将生成的 SAS 代码快速集成到各种基于 SAS 开发的应用系统中
  • 可以将 R 模型和 SAS 模型进行预测性能方面的比较
  • 可以对 R 模型和 SAS 模型进行性能监测
  • 需要购买 SAS Model Manager(12.1 版本),成本高
  • 目前仅支持几种常用的 PMML 模型

3)民间研发:通过宏 Proc_R 实现在 SAS 里面提交 R 代码

PROC_R 于 2012 年发表在 Journal of Statistical Software 上,是一位华人 Wei Xin 在美国罗氏制药公司工作期间发表的。

  • 因为 R 代码本质上是在 R 里运行,所以全面支持 R 的各种模型和函数。
  • 不需要购买 SAS/IML,成本低。
  • 只支持 Windows 系统,使用者如果有一定编程功底,可以将源代码改造成 Linux 可用的版本。
  • 数据交换通过 csv 文件实现,可能不支持 SAS FORMAT(有待验证)。
  • 错误捕获等方面略弱

4)民间研发:将 R 生成的神经网络和决策树模型翻译成 SAS 代码

  • 可以将生成的 SAS 代码快速集成到各种基于 SAS 开发的应用系统中
  • Windows、Linux 都支持
  • 不需要购买 SAS/IML 或者 SAS/EM,成本低。
  • 目前只支持神经网络和决策树模型
  • 没有处理自变量取值缺失的情况

三、集成方式的详细介绍

以上四种方式我在下面的文章中有详细的介绍,有兴趣的同学可以阅读。

R 与 SAS 的集成(一)

R 与 SAS 的集成(二)

R 与 SAS 的集成(三)

R 与 SAS 的集成(四)

敬告各位友媒,如需转载,请与统计之都小编联系(直接留言或发至邮箱:[email protected]),获准转载的请在显著位置注明作者和出处(转载自:统计之都),并在文章结尾处附上统计之都微信二维码。

统计之都微信二维码

← 应聘准备:非统计和计算机背景的学生如何找到 SAS 程序员的工作? COS 每周精选: 让祸害人间的显著性星号消失吧! →

发表 / 查看评论


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK