cran
R现在能interface with BUGS,ADMB-RE等等的东西,我在想能不能也用SAS,这样我就能在R里用SAS 里面的output了。我的设想是不是天慌夜谈呢?
rtist
不是,我也想过这个。但是后来因为我用的sas是server上的,实现起来很麻烦,我就没接着做,但是从技术条件上来说不是不可能做。
whiz
可以试试这样作:假设你有一个SAS文件test在 c:\sas codes\ 下,则在R中用
> system('"c:\\program files\\sas institute\\sas\\v8\\sas.exe" "c:\\sas codes\\test"')
我没有自己试过,不过应该可行。
cran
[quote]引用第2楼whiz于2007-03-15 17:06发表的“”:
可以试试这样作:假设你有一个SAS文件test在 c:sas codes 下,则在R中用
> system('"c:\program files\sas institute\sas\v8\sas.exe" "c:\sas codes\test"')
我没有自己试过,不过应该可行。[/quote]
Good idea, I will try, thanks
cran
如果能在R import sasdata就好了
yihui
[quote]引用第2楼whiz于2007-03-15 17:06发表的“”:
可以试试这样作:假设你有一个SAS文件test在 c:sas codes 下,则在R中用
> system('"c:\program files\sas institute\sas\v8\sas.exe" "c:\sas codes\test"')
我没有自己试过,不过应该可行。[/quote]
最好用paste函数把前面的exe和后面的文件结合到一起,不然字符串里面的空格会让R以为"c:\program"是一个可执行程序。
whiz
在命令外面还用了一个单引号,应该没问题。另外,反斜杠必须是两个并用,不然可能有问题。
cran
发现R里面有一个package.
-----------------
foreign: Read Data Stored by Minitab, S, SAS, SPSS, Stata, Systat, dBase,
Functions for reading and writing data stored by statistical packages such as Minitab, S, SAS, SPSS, Stata, Systat, ..., and for reading and writing .dbf (dBase) files.
Version: 0.8-18
Priority: recommended
Depends: R (>= 2.4.0), stats
Imports: methods
Date: 2006-11-29
Author: R-core members, Saikat DebRoy, Roger Bivand and others: see COPYRIGHTS file in the sources.
Maintainer: R-core
License: GPL version 2 or later
Downloads:
Package source: foreign_0.8-18.tar.gz
MacOS X binary: foreign_0.8-18.tgz
Windows binary: foreign_0.8-18.zip
Reference manual: foreign.pdf
---------------------
真好
sociology
[quote]引用第7楼cran于2007-03-20 05:27发表的“”:
发现R里面有一个package.
-----------------
foreign: Read Data Stored by Minitab, S, SAS, SPSS, Stata, Systat, dBase,
Functions for reading and writing data stored by statistical packages such as Minitab, S, SAS, SPSS, Stata, Systat, ..., and for reading and writing .dbf (dBase) files.
.......[/quote]
It is shipped with offical R.
rtist
恩,直接读ods出来的dataset应该很容易,我以前净考虑用perl重新parse lst file了。
这么说,自动处理的难度更小了。
yihui
[quote]引用第7楼cran于2007-03-20 05:27发表的“”:
发现R里面有一个package.
-----------------
foreign: Read Data Stored by Minitab, S, SAS, SPSS, Stata, Systat, dBase,
Functions for reading and writing data stored by statistical packages such as Minitab, S, SAS, SPSS, Stata, Systat, ..., and for reading and writing .dbf (dBase) files.
.......[/quote]
这个包是Recommended的啊,我还以为你早知道呢:)
whiz
我也以为cran是想调用SAS的结果,原来cran是想在R中用SASdata....
cran
[quote]引用第11楼whiz于2007-03-21 09:26发表的“”:
我也以为cran是想调用SAS的结果,原来cran是想在R中用SASdata....[/quote]
都想用。因为有些sas的procedure很好的
rtist
是啊,因为sas结果基本上都可以放到data里面,所以实际上还是在调用data,这样处理的难度低了很多很多。