[R] R and SAS

Douglas Bates bates at stat.wisc.edu
Thu May 31 21:26:40 CEST 2001

Janne Pitkäniemi <Janne.Pitkaniemi at ktl.fi> writes:

>     I'm trying to read SAS-data on VAX/VMS to Windows R using
>     foreign pakage read.xport and experience some problems.
>     Following lines are used in SAS to create XPORT file
>      LIBNAME a ''xxx;
>      LIBNAME b XPORT '';
>      PROC COPY IN=a OUT=b;
>      RUN;
>    and I succeed in getting file that looks like correct xport
> file.However
>    when typing in R following lines
>   read.xport("htpa2000.txt")
>   I get message
>  Error in lookup.xport(file) : SAS transfer file has incorrect library
> header
>  Does anyone has advice ? Is the problem in VAX/VMS SAS XPORT file ?

Can you send us the first 160 characters of the file?  It is supposed to be
in text format (more or less) and should look something like

HEADER RECORD*******LIBRARY HEADER RECORD!!!!!!!000000000000000000000000000000  SAS     SAS     SASLIB  7.00    OSF1                            10DEC99:15:56:30

It does not contain any carriage returns or line feeds.

This is what SAS claims in their documentation is the correct initial line 
in the XPORT format.  Hence this is what we check for.

What SAS actually creates is often different.
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list