[R] SASxport function read.xport gives error "object 'w' not found"

Marc Schwartz marc_schwartz at me.com
Fri Jul 25 20:20:43 CEST 2014

On Jul 25, 2014, at 8:26 AM, Jocelyn Ireson-Paine <popx at j-paine.org> wrote:

> The subject line says it. I've just tried converting an SAS .xpt file with this call:
>  > read.xport( 'formats.xpt' )
> I get the message
>  Error in read.xport("formats.xpt") : object 'w' not found
> but there's no explanation about what 'w' is or how I should make it known to R. I certainly wasn't expecting to have to provide such a variable, unless I've overlooked something in the SASxport documentation.
> This is using R version 3.1.0 under Windows 7, and SASxport installed this morning: version 1.5.0 (2014-07-21).
> Any idea what this 'w' is that read.xport wants me to give it?
> The .xpt file is confidential, so I can't make it available, and I don't know exactly what's in it. I suspect, however, that it may contain quite a bit of text. However, I'm pretty sure that its author used SAS correctly when generating it. Other files containing purely numeric data from the same author converted OK, using analogous calls to read.xport .
> Googling the error didn't find anything.
> Thanks,
> Jocelyn Ireson-Paine
> 07768 534 091
> http://www.jocelyns-cartoons.co.uk

Have you tried reading the file with the read.xport() function in the foreign package, which is part of the default R installation?


I would start a fresh R session, just to be sure that the SASxport version is not used unintentionally.

There might be a bug in the SASxport version of the function, which apparently uses some of the foreign package version's code, or there might be something about your xpt file that is causing a problem. You may need to contact Greg, who is the package maintainer for SASxport, to get a sense from him as to what would trigger the error you are experiencing. Otherwise, you may have to trace through the code (see ?debug, for example) with your file and see if you can identify a trigger.


Marc Schwartz

More information about the R-help mailing list