[R] Concerning reading of SAS-files
Frank E Harrell Jr
f.harrell at vanderbilt.edu
Fri Aug 12 17:26:39 CEST 2005
bogdan romocea wrote:
> The first one is an index, not a data set. Anyway, just use SAS to
> export the data sets in text format (CSV, tab-delimited etc). You can
> then easily read those in R. (By the way, the help for read.xport says
> that 'The file must be in SAS XPORT format.' Is .sas7bdat an XPORT
> file? Hint: no.)
>
>
>
>>-----Original Message-----
>>From: Fredrik Thuring [mailto:frt at Codan.dk]
>>Sent: Friday, August 12, 2005 4:52 AM
>>To: r-help at stat.math.ethz.ch
>>Subject: [R] Concerning reading of SAS-files
>>
>>
>>
>>Hi!
>>
>>I'm trying to start a credibility estimation study with a
>>coule of data
>>sets that are created for SAS. The data sets are saved as
>>".sas7bndx" and
>>".sas7bdat".
>>I've tried reading them to R with the function 'read.xport' but this
>>returns the error message 'Error in lookup.xport(file) :
>>unable to open
>>file'.
>>Are there any other functions that one could use instead?
>>
>>Thanks a lot to who ever can solve my problem!
>>
>>Fredrik Thuring
>>Codan Insurance, Copenhagen
If you want to go the CSV route, the sasxport.get function in Hmisc can
help. Its help function references a Howto on our web site. Beware
that SAS PROC EXPORT which it uses is not really a PROC but a stored
macro (where do all the billions of $ SAS earns go?) that has a bug if
you have an unmatched quote in a field. sasxport.get will detect the
problem because it compares the number of observations to that reported
by PROC CONTENTS.
Frank Harrell
More information about the R-help
mailing list