[R] Read a .sas7bdat file
Marc Schwartz
marc_schwartz at comcast.net
Sun Mar 18 19:01:25 CET 2007
On Sun, 2007-03-18 at 18:42 +0100, David Hajage wrote:
> Hello useRs,
>
> I would like to import a data frame in a sas format (.sas7bdat).
>
> I have installed "foreign" library, and tryed to use "read.ssd" function :
>
> > read.ssd("these", "fus9706.sas7bdat")
> sh: sas: not found
> SAS failed. SAS program at /tmp/RtmpPdVSST/file2ae8944a.sas
> a log and other error products should be in the vicinity
> ls: file2ae8944a.log: Aucun fichier ou rpertoire de ce type
> NULL
> Warning message:
> Le code renvoy par SAS est 32512 in: read.ssd("these", "fus9706.sas7bdat")
>
> Is it possible to read this file with R ?
>
> Thank you for your help.
>
> David
That format is proprietary to SAS. You would need:
1. A licensed copy of SAS available (which is called from read.ssd())
and the lack of which results in the error above. Note the 'sascmd'
argument in read.ssd():
character string giving full path to SAS executable.
2. A third party conversion application (such as DBMS/Copy) which can
read the proprietary SAS dataset and export it to a format that can be
read by R, such as a CSV file.
If the entity that provided you with the SAS dataset can export it to an
alternative format, that would be helpful. There are also functions
available in R which can read the so-called SAS Transport format (which
is openly defined). These would include:
read.xport() in foreign
sasxport.get() in Hmisc, which uses the former
You may wish to search the r-help archives as I recall issues with the
use of the above functions that may require some further insights.
HTH,
Marc Schwartz
More information about the R-help
mailing list