[Rd] read.spss() cannot import some SPSS files (PR#9074)

From: <tim.bock_at_numbers.net.au>
Date: Wed 12 Jul 2006 - 05:52:35 GMT

Full_Name: Tim Bock
Version: 2.3.1
OS: Windows XP
Submission from: (NULL) (

SPSS v12 on Windows sometimes writes files with a layout_code of 3 instead of the usual layout_code of 2. While I don't know what this signifies, R is able to read these files if I change sfm-read.c to accept 3.

Also, R issues an unnecessary warning when it finds records of type 7 with sub-type 7. These records describe multiple-response sets, which can safely be ignored.

Here are my suggested changes, based on the foreign_0.8-15.tar.gz. (I'd be happy to commit these via svn, but I assume that this is not allowed for non-core developers.)

> case 7: /* Multiple-response sets (later versions of
SPSS). */
> R_int32 orig_layout_code;

< if (hdr.layout_code == 2)


> if (hdr.layout_code == 2 || hdr.layout_code == 3)
> orig_layout_code = hdr.layout_code;
656,658c659,661 < if (hdr.layout_code != 2) < lose ((_("%s: File layout code has unexpected value %d. Value should be 2, in big-endian or little-endian format"), < h->fn, hdr.layout_code)); ---
> if (hdr.layout_code != 2 && hdr.layout_code != 3)
> lose ((_("%s: File layout code has unexpected value %d (or %d,
endian-reversed). Value should be 2 or 3, in big-endian or little-endian format"),
> h->fn, orig_layout_code, hdr.layout_code));
______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed Jul 12 15:57:29 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 12 Jul 2006 - 08:29:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.