[R] SPSS and library(foreign)

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Feb 16 09:55:45 CET 2007


On Fri, 16 Feb 2007, Anthony Staines wrote:

> Hi,
> I have a valid SPSS .sav file (which I can open happily in SPSS v11 on
> Windows XP).
>
> Opening it in R2.41 on Linux we get this message :-
>
>> HSE3023 <- read.spss("HSE.sav")
> Error in read.spss("HSE.sav") :
> 	error reading system-file header
> In addition: Warning message: HSE.sav:
> Variable X234 indicates variable label of invalid length 256
>
> Now variable X234 has indeed a silly label, which we can easily fix,
> but I'm more worried about the  'error reading system-file header'.

The warning is the reason for the error.

> Any ideas - are there multiple versions of the SPSS format, are there

There are multiple versions.  It is a proprietary format, and AFAIK has 
been reverse-engineered for PSPP in the late 1980s (in the version used in 
package foreign).

PSPP has been changed since its code was forked for package foreign, but 
this limit has not.  It is likely this is a limitation of PSPP and not the 
format.

> OS issues?  I can't find anything helpful about the format either on
> the SPSS site, or on the PSPP site. We have earlier versions of SPSS
> around, so we re-install one and we could re-write it if that would
> help.
>
> Anthony Staines
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list