DATA LIST [FILE='<file name>'] [FREE]
/ <list of variables>.
When this command is successfully run, SPSS creates the Active File -- which is a system version of your original data -- and unless replaced or modified by later commands this is the version of your data which all later commands use and analyze. In Windowing environments, the Active File appears as a spreadsheet in the Data Window.
Raw data may be entered in a separate (external) file or in- stream. If data are entered in an external file and a program (syntax) is being used to read them in, the FILE= keyword is necessary on the data list command to tell SPSS where to look for the data. If a point-and-click method is used to read in data, the process is guided by a Data Entry Wizard invoked by clicking File>Read Text (or ASCII) Data.
Example of DATA LIST using raw data in an external file:
data list free file='my.data' / idnum height weight iq.
If the data are entered in-stream (i.e.,
in the program itself along with the commands and subcommands),
there is no FILE= keyword and the commands BEGIN DATA and END
DATA are placed before and after the actual raw data as it
appears in the program just after the DATA LIST command.Example of DATA LIST using in-stream entry of raw data:
data list free / idnum height weight iq.
begin data.
1 52 105 98
2 61 184 102
3 47 89 110
4 53 112 87
end data.
Occasionally people will create (or otherwise obtain) data files
with records longer than the default LRECL (Logical RECord
Length) of 1024 bytes. When this is the case, SPSS must have
instructions to read a longer record, and such instructions are
given in a FILE HANDLE statement. The FILE HANDLE is a
"nickname" that is used in place of an actual file name when raw
data are being read into a DATA LIST command.
In the following example, the file "lrecl1500.data" (which has a logical record length of 1500) is assigned to the FILE HANDLE "toolong", which is then used in the DATA LIST command in place of the actual file name.
file handle toolong / name='lrecl1500.data' lrecl=1500.
data list file=toolong / var1 1-5 var2 456-458
var3 1362-1365.
Sometimes a raw data file will have data on more than one record
(line) for each observation.
In some such cases it is necessary to use FIXED (the default) format,
and enter a RECORDS keyword in the DATA LIST command, then put a
slash ("/") between the variable names for each line.
The following example has data on three records for each observation,
showing how to construct the DATA LIST command.
10001 785
42 55 38
2854
10002 775
98 54 26
3864
10003 685
73 18 43
2754
<etc.>
data list file="d:\threelines.txt" records=3 /
var1 1-5 var2 7-9 / var3 1-2 var4 4-5 var5 7-8 / var6 1-4.
SAMPLE: data in the file "D:\threelines.txt":