Date: Fri, 11 Aug 2006 17:32:23 -0400
Reply-To: Richard Ristow <wrristow@mindspring.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Richard Ristow <wrristow@mindspring.com>
Subject: Re: Text fields
In-Reply-To: <6.2.1.2.2.20060811095100.02879670@hawaii.edu>
Content-Type: text/plain; charset="us-ascii"; format=flowed
At 04:06 PM 8/11/2006, Bob Schacht wrote:
>Seems to me that I recall that someone mentioned that SPSS can do
>variable length text fields, like Microsoft Access does. Is this true,
>and if so, is this capability available in ver. 12?
Alas, no, nor in any actual or contemplated version I know of.
>Also, I have heard that SPSS can things like linking two databases (at
>least 1:1)
>without merging them.
Not that, either, again in any version I know of.
>The problem is with a field that 90% never answer, 9% provide a short
>answer, and 1% provide a really long answer. O, of course, is that you
>have to make every field wide enough to hold the widest data for that
>fieldd, so that if you have an open-ended response item that 90% never
>answer, 9% provide a short answer, and 1% provide a really long
>answer, then you still have to allocate space for the field based on
>the longest answer, which of course wastes a lot of space
First, this is one case where save-file compression (it's the default,
but can also be specified) may help a lot. Try a test with a large
subset of the file, and compare actual saved size vs. worst-case size.
You may be all right.
Second, you don't have to like this, but if you can live with your file
always sorted by Rspdt_ID, and three saved files, you can do something
like this (code not tested). It assumes file handles MAIN, Long_Ans,
Shrt_Ans, whose meanings should become clear. I'll give your
long-response variable the name VERBOSE.
. It may not save enough additional space to be worth using file
Shrt_Ans. Try it.
. You can extend this to any number of such fields. You need two (or
one) auxiliary files for each, and separate DO IF/ XSAVE logic for
each.
* To write the survey file: .
* --------------------------------- .
<Code to read the survey records, including VERBOSE in its long form>
* The following COMPUTE is a general good idea:.
COMPUTE VERBOSE = LTRIM(VERBOSE).
* Skip the following if you don't need it: .
SORT CASES BY Rspdt_ID.
* Write three files: Long responses, short responses,.
* and everything else. .
* (Choose length of CONCISE as appropriate, but to .
* get best use of it, its length should be a .
* multiple of 8) .
STRING CONCISE (A8).
DO IF LENGTH(RTRIM(VERBOSE)) GT 8.
. XSAVE OUTFILE = LONG_ANS
/KEEP = Rspdt_ID VERBOSE.
ELSE IF LENGTH(RTRIM(VERBOSE)) GT 1.
. COMPUTE CONCISE = VERBOSE.
. XSAVE OUTFILE = Shrt_Ans
/KEEP = Rspdt_ID CONCISE.
END IF.
SAVE OUTFILE= MAIN
/DROP= VERBOSE CONCISE.
* To read the survey file: .
* --------------------------------- .
* This reloads VERBOSE. In runs that.
* don't use VERBOSE, a simple .
* . GET FILE MAIN. .
* will suffice. .
MATCH FILES
/FILE=MAIN
/FILE=Long_Ans
/FILE=Shrt_Ans
/BY Rspdt_ID.
IF (VERBOSE EQ ' ')
VERBOSE = CONCISE.