6

I have plenty of .rda and .RData files from R statistical packageand would like to read them into SAS. Is there an (easy) way to do this?

Marcin
  • 7,834
  • 8
  • 52
  • 99
  • are they just data frames? why not write to a csv and read that into sas? or maybe [this](http://support.sas.com/documentation/cdl/en/mdsug/65072/HTML/default/viewer.htm#p1bl4ds513zp00n0z9twwsmkzoy8.htm) – rawr Mar 31 '15 at 19:36
  • Those are already .rda and .Rdata files. Not objects in R global environment. – Marcin Mar 31 '15 at 19:38
  • @rawr's link would be a great way to go if you have SAS/IML licensed, otherwise why not just use R? ;) – Alex A. Mar 31 '15 at 19:39
  • You can convert them from .rda or .RData to a more portable format (like CSV) using R (`write.csv`) or something like Stat/Transfer. – Thomas Mar 31 '15 at 19:44
  • Let's assume I don't Have R installed and can't install it Because of internet connection lack. – Marcin Mar 31 '15 at 19:59
  • I don't think so: https://communities.sas.com/message/241238 – Ben Bolker Mar 31 '15 at 21:01
  • Do you have a SAS/IML license? – Reeza Mar 31 '15 at 21:46
  • You have to have R installed to use the IML facility to read R objects into SAS. – DomPazz Mar 31 '15 at 21:51
  • I think SAS/IML still needs R to connect to R, doesn't it? – Joe Mar 31 '15 at 21:51

1 Answers1

1

If you can get R installed, then you could execute R code within PROC IML (assuming your SAS installation is configured properly, which can be a problem), read the results into e.g. a R data.frame and get the results back as described in the SAS documentation examples. If you do not have the SAS/IML license but have R, write the output out from R into some format SAS reads easily (e.g. csv). If you cannot get R installed on your system, can someone else with R installed do that for you?

Otherwise, you may have to write a SAS program that can parse the RData format. However, that would be a measure of desperation. I believe you would find the documentation of the format here and some discussion of the not so clear documentation here (see also)

Björn
  • 644
  • 10
  • 23