A colleague sent me the following information on moving SPSS files to R:
Stat/Transfer doesn’t do this. For you non-R users, here’s how they can do it on their computer (since we don’t have R):
Open R. Under “File” pulldown menu, “Change Dir” to where the data is…
require(foreign)
mydata <- read.spss("bogus.sav",use.value.labels = TRUE, to.data.frame = TRUE)
You want to move to the directory where your data is after you open R, because R doesn’t seem to like paths in the file name.
“require(foreign)” loads a library of functions for reading data
read.dta and read.sas are similar functions for Stata and SAS. R also has a bunch of functions to read ASCII data:
read.cvs read.table read.delim
Somewhat confusingly, paths in R have to be specified using / rather than the backslash. For instance:
read.spss("E:/work/bogus.sav")
To set the work directory:
setwd("E:/work")
it seems like the foreign package has trouble with SPSS missing values. A common error when importing from read.spss is a system-file header error;
File layout code has unexpected value 50331648. Value should be 2, in big-endian or little-endian format
I am not sure of the solution (yet) apart from going back to SPSS and editing the actual database.
To update on my previous comment, it seems like read.spss will give you a warning message from a file from SPSS 12.0 or higher. Beginning with SPSS 12 the file format was changed to accommodate long variable names, while keeping the short (eight character) variable names to be compatible with older versions. The read.spss function has not been updated. It reads the short names, ignores the long names, and produces the warning you cite. There does not seem to be any error in reading the data, other than the warning and continued use of short variable names. Unfortunately the author of the package has not updated this yet!