9

I've been trying to import data into R using a .dat and .sps files. The .dat file has no headers and varying lengths of columns which are of course included in the .sps file. It also contains missing values. I've tried using spss.fixed.file from package memisc but when I specify it as:

x=spss.fixed.file(file=data.dat,columns.file=input.sps,varlab.file=input.sps)

and I get the following error:

Error in spss.parse.variable.labels(varlab.file) : too many 'variable label' statments

Has anyone used this command/package before? I can't understand whether it's ok for both the columns.file and the varla.file to be the same file, given all that information is included in the same .sps file. Any help would be very much appreciated!

joran
  • 169,992
  • 32
  • 429
  • 468
Juan
  • 121
  • 1
  • 3
  • Package `foreign` doesn't provide all the functionality to import your data? – Roman Luštrik Jul 25 '12 at 15:29
  • 5
    As far as I know, read.spss only takes .sav files as input. These files are generated in SPSS by running the .sps file on the corresponding .dat file, which is exactly what I want to do in R, thus skipping the whole generation of the .sav file. – Juan Jul 25 '12 at 16:50
  • 2
    I'd recommend trying the haven package as likely to be better developed. (As a rule of thumb, basic typos in the error message, e.g. 'statments', suggests a less developed package.) – JonMinton Sep 30 '18 at 08:53
  • you may just be onto something, @JonMinton haha! This is quite an old post now and normally have been able to work perfectly with haven or foreign... thanks all! – Juan Oct 02 '18 at 09:17

0 Answers0