[R] Reading sas7bdat files into R

Daniel Nordlund djnordlund at frontier.com
Tue Dec 28 02:32:49 CET 2010


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of John Sorkin
> Sent: Monday, December 27, 2010 5:18 PM
> To: challa at ohsu.edu; r-help at r-project.org
> Subject: Re: [R] Reading sas7bdat files into R
> 
> Try sas.get to read the library. You will need the Hmisc package.
> Let me know if you have success.
> John
> John Sorkin
> Chief Biostatistics and Informatics
> Univ. of Maryland School of Medicine
> Division of Gerontology and Geriatric Medicine
> JSorkin at grecc.umaryland.edu
> -----Original Message-----
> From: Sashi Challa <challa at ohsu.edu>
> To: John Sorkin <jsorkin at grecc.umaryland.edu>
> To: r-help at r-project.org <r-help at r-project.org>
> 
> Sent: 12/27/2010 7:58:22 PM
> Subject: RE: [R] Reading sas7bdat files into R
> 
> Thanks for your reply John.
> 
> I guess you are correct, sasxport.get function is for files in SAS
> transfer format.
> 
> Do you know how I can convert the .sas7bdat file into SAS export file that
> I suppose will be in SAS transfer format?
> 
> Thanks
> Sashi
> 

Sashi,

There are very few "free" options for reading .sas7bdat files.  The sas.get() function in the Hmisc package will only work if you have a working copy of SAS available.  Your best bet may be to get the person who gave you the file to give you a copy of the file in SAS xport format, or output as a csv file.  If that is not possible, and the file is not too large, you can download the free SAS viewer from SAS and convert the file to a csv.  There are other options using various commercial products as well.  If you can tell us more about your situation, someone may be able to give you more options.  But unfortunately, SAS doesn't make it easy to use their native data files outside of SAS.

Dan

Daniel Nordlund
Bothell, WA USA



More information about the R-help mailing list