Re: [R] Read SAS data into R

From: Marc Schwartz <>
Date: Fri, 11 May 2007 14:40:42 -0500

On Fri, 2007-05-11 at 13:43 -0500, Frank E Harrell Jr wrote:
> kseefeld wrote:
> > Kim’s EZ Recipe for….
> >
> > SAS TO R, perfectly formatted table with no loss of data
> >
> > • In SAS: Export SAS DB as access db
> > • In R go to directory where access db is stored
> > • Use package RODBC
> >
> > #R code
> > #Create connection object (Can set up DSN but I’m too lazy to)
> > c<-odbcConnectAccess("x.mdb")
> > #Create table object, store db in object
> > x<-sqlFetch(c, "test")
> > #Close connection object
> > odbcClose(c)
> >
> >
> That doesn't help people who don't have SAS.
> Note that an upcoming release of the Hmisc package has a new Access
> import function for users who have access to the mdbtools package on
> their operating system (e.g., linux).

mdbtools is also being used by the folks:

Just to follow up on Frank's prior post regarding the SAS System Viewer, that does work well under Wine on Linux, with the caveat that Frank notes.

I also use DBMS/Copy under Wine and that works quite well.

One of the advantages of DBMS/Copy versus the System Viewer is wider support for the proprietary SAS formats from various OSs. We recently were in receipt of SAS datasets that were generated on a 64 bit Unix platform. The SAS System Viewer choked on them, but DBMS/Copy had no problem.

The SAS System Viewer is a free download, whereas DBMS/Copy is not, so it places an emphasis on either getting SAS datasets from Windows based installations or ensuring that the entity generating the datasets outputs SAS Transport format files instead.

HTH, Marc Schwartz mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri 11 May 2007 - 19:50:47 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 11 May 2007 - 20:33:40 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.