For some reason, the mailing list got dropped from my reply below.

  
 
--
 Kevin E. Thorpe
 Head of Biostatistics,  Applied Health Research Centre (AHRC)
 Li Ka Shing Knowledge Institute of St. Michael's
 Assistant Professor, Dalla Lana School of Public Health
 University of Toronto
 email: kevin.tho...@utoronto.ca  Tel: 416.864.5776  Fax: 416.864.3016
 
     



From: Kevin Thorpe
Sent: Friday, October 19, 2018 12:30 PM
To: Bert Gunter; Marc Schwartz
Subject: Re: [R] Importing SAS datasets into R efficiently
  

Related to Marc's suggestion, if you have SAS on the same computer as R, try 
the sas.get function in the Hmisc package.

I know it doesn't help you, but I have not had speed issues with haven.

Kevin
  
 
--
 Kevin E. Thorpe
 Head of Biostatistics,  Applied Health Research Centre (AHRC)
 Li Ka Shing Knowledge Institute of St. Michael's
 Assistant Professor, Dalla Lana School of Public Health
 University of Toronto
 email: kevin.tho...@utoronto.ca  Tel: 416.864.5776  Fax: 416.864.3016
 
     



From: R-help <r-help-boun...@r-project.org> on behalf of Marc Schwartz via 
R-help <r-help@r-project.org>
Sent: Friday, October 19, 2018 11:05 AM
To: Bert Gunter
Cc: R-help
Subject: Re: [R] Importing SAS datasets into R efficiently
  

Hi,

'foreign' will only read SAS XPT files, not the proprietary BDAT files, which I 
presume is the case here.

I don't use 'haven', but it looks like the key functions are written in C/C++, 
which should be relatively efficient.

If you are having specific issues with particular files,  because they are 
rather large, and/or have some kind of complex structure, you might want to 
communicate directly with the haven maintainers to see if there are some 
performance bottlenecks that perhaps   they can resolve.

The only other option, to my knowledge, to directly read BDAT files in R, is 
the sas7bdat package on CRAN:

  https://cran.r-project.org/web/packages/sas7bdat/ 
<https://cran.r-project.org/web/packages/sas7bdat/>


CRAN - Package sas7bdat
cran.r-project.org
sas7bdat: SAS Database Reader (experimental) Read SAS files in the sas7bdat 
data format.


CRAN - Package sas7bdat
cran.r-project.org
sas7bdat: SAS Database Reader (experimental) Read SAS files in the sas7bdat 
data format.

However, it looks like it has not been updated in several years, so not sure of 
status.

Another alternative, if you have access to SAS, is to export the BDAT 
datasets(s) to CSV files in SAS, and them import them into R, using read.csv().

Regards,

Marc Schwartz


> On Oct 19, 2018, at 10:41 AM, Bert Gunter <bgunter.4...@gmail.com> wrote:
> 
> Have you looked at the "foreign" package?
> 
> -- Bert
> 
> Bert Gunter
> 
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
> 
> 
> On Fri, Oct 19, 2018 at 6:48 AM Jomy Jose <infoj...@gmail.com> wrote:
> 
>> Hi
>> 
>> Is there an efficient way to import SAS datasets into R,presently while
>> using haven package it takes long time...Is there a smart work around this
>> ?
>> 
>> Thanks in advance
>> Jose


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide   http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
        
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to