Blog Viewer

importing SAS dataset to R

  
Can anyone help me with how to import SAS dataset in to R software.
I am familiar with SPLUS.
I am trying to use R to create Graphics.
Thanks

Ratna
Director of Biostatistics
J&J
2 comments
341 views

Permalink

Tag

Comments

07-26-2016 11:22

There are two parts to the question:

1. Importing SAS dataset.

2.What graphics you want to do. Is it dashboard.

The first one is easy to answer, using sas7bdat package. After importing you may need to convert the factors and other data types as per the need. However, it depends on the size as well which further depends on the memory of the server or platform one uses.  For the 2nd question, once the data is imported through a data frame, the data manipulation is the same like any other dataset in R/SPlus, in my experience.

10-11-2012 12:30

First, you should know that SAS's graphics have greatly improved in recent years.
(1) If you are using the SAS analytical procedures (for example, SAS/STAT) the procedures create many plots automatically: http://support.sas.com/resources/papers/76822_ODSGraph2011.pdf
(2) If you need a do-it-yourself plot, there are the SG procedures: http://www.wuss.org/proceedings08/08WUSS%20Proceedings/papers/how/how05.pdf
(3) If you need more power, the Graph Template Language can create virtually any graph: http://support.sas.com/resources/papers/sgf2008/gtl.pdf
That said, there are two ways to import SAS data sets into R. If you have SAS (in particular, SAS/IML), there is a built-in interface to R that includes functions to transfer SAS data sets to and from R data frames. See http://support.sas.com/documentation/cdl/en/imlug/65547/HTML/default/viewer.htm#imlug_r_toc.htm
Lastly, if you don't have SAS but obtained the SAS data set through a third party, there is an R package (see http://biostatmatt.com/archives/1468) that the author claims can read SAS data sets. I have not used it myself.