From tim.bock at numbers.net.au  Wed Jul 12 07:52:35 2006
From: tim.bock at numbers.net.au (tim.bock at numbers.net.au)
Date: Wed, 12 Jul 2006 07:52:35 +0200 (CEST)
Subject: [Rd] read.spss() cannot import some SPSS files (PR#9074)
Message-ID: <20060712055235.49C1F53573@slim.kubism.ku.dk>

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


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.)

413a414
>               case 7: /* Multiple-response sets (later versions of 
SPSS). */
580a582
>   R_int32 orig_layout_code;
651c653
<   if (hdr.layout_code == 2)
---
>   if (hdr.layout_code == 2 || hdr.layout_code == 3)
654a657
>       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));



[Rd] read.spss() cannot import some SPSS files (PR#9074)
tim.bock at numbers.net.au