From tlumley at u.washington.edu  Tue Oct 11 16:40:24 2005
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Tue, 11 Oct 2005 07:40:24 -0700 (PDT)
Subject: [Rd] 8 char labels in read.spss
In-Reply-To: <434B89CB.70209@biostatistic.de>
References: <434B89CB.70209@biostatistic.de>
Message-ID: <Pine.LNX.4.63a.0510110734250.27917@homer24.u.washington.edu>

On Tue, 11 Oct 2005, Knut Krueger wrote:

> I was wondering why it is possible to read long labels from the CVS
> files but not from the SPSS files.

The SPSS file formats are not documented, and so we rely on the code from 
PSPP.  At the time, PSPP did not read long variable names.  It now does, 
so it would be possible for someone update the SPSS-reading code to handle 
long variable names.  This is much more complicated than just changing a 
#define; the long variable names are stored in a different part of the 
file.

I don't expect anyone on R-core to get around to this any time soon. If 
you want to try, the current PSPP code is at
    http://savannah.gnu.org/projects/pspp

 	-thomas


> I did not have much time to search for the code but I found:
>
> in foreign_0.8-10 source file var.h.in
>
>> /* Definition of the max length of a short string value, generally
>>    eight characters.  */
>> #define MAX_SHORT_STRING ((SIZEOF_DOUBLE)>=8 ? ((SIZEOF_DOUBLE)+1)/2*2
>> : 8)
>> #define MIN_LONG_STRING (MAX_SHORT_STRING+1)
>>
>> /* FYI: It is a bad situation if sizeof(R_flt64) < MAX_SHORT_STRING:
>>    then short string missing values can be truncated in system files
>>    because there's only room for as many characters as can fit in a
>>    R_flt64. */
>> #if MAX_SHORT_STRING > 8
>> #error MAX_SHORT_STRING must be less than 8.
>> #endif
>
> I am am right then there was a restriction in the year 2000 because the
> files are from the year 2000.
>
> Now there are some questions:
> Did I found the right code?
> is it possible that anybody could recompile this with long value names
> or where is the best manual for a quick start in compiling packages.
>
>
> I found a couple of weeks before a tread where anybody wrote a complete
> way for building packages.
> He described all problems of him and there were a lot of hints for the
> first steps, but I am not able to find it again - I don't know the
> search terms which I used before :-(
>
>
> with regards
> Knut
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle



[Rd] 8 char labels in read.spss
Thomas Lumley