PROBLEM: SPSS reads data incorrectly because the raw data
line length is longer than the default of 1024 bytes
(NOTE: this is especially important in SPSS for Windows,
because the only solution is to write and run a syntax
program, as shown below; there is no point-and-click
solution)
SOLUTION: using Syntax (i.e., an SPSS program), issue the
FILE HANDLE command with an LRECL= keyword, then refer
to the raw data with the FILE HANDLE nickname
Example: you have a raw data file called my.dat in which
the longest line is 2450 bytes long. The usual method is
as follows, but
***THIS DOES NOT WORK.
data list file='my.dat' / id 1-5 sex 645 height 2401-2403.
list.
execute.
To make this work, use the FILE HANDLE command to set up a
file 'nickname', so that you can use the LRECL= keyword.
***THIS WORKS.
file handle filnick / name='my.dat' / lrecl=2450.
data list file=filnick / id 1-5 sex 645 height 2401-2403.
list.
execute.
Note that if you don't know the length of the longest record
in your data, it is permissible (with no negative aftereffects)
to use a number that is longer than your data records. For example,
if you know some or all of your records are longer than 1024, but
you don't know the exact length, but you're sure nothing is as
long as 5000 bytes, it is OK to use LRECL=5000 to get your data
file read by SPSS.