Question: I have a large number of
SPSS listing
files (output from a statistical analysis) that I am interested in
extracting information from for subsequent analysis. For instance,
the SPSS regression procedure (REGRESSION) does not allow me to save
various regression summaries to a data file (e.g. MSE, R squared, beta
coefficients, F values, p values, etc.). I understand that I can use the
MATRIX - END MATRIX commands to write my own statistical routines, thus
enabling me more flexibility in the output of information that is
calculated. However, for the sake of efficiency, I am not interested
in recreating statistical procedures that have already implemented. Nor
am I interested in reading information off of the listing files to type
back into a data file. Is there a simple way to read these listing files
back in as data and extract the information I am interested in?
Answer: SPSS provides several alternatives to the more commonly
used FIXED' and FREE' data formats. The SPSS commands FILE TYPE - END FILE
TYPE allow the user to define data for the following complex file types: mixed files,
nested files, grouped files, and repeating groups (see the SPSS Reference Guide (1990)
for further details). Here, I will demonstrate the usage of the FILE TYPE NESTED
command.
Suppose I am interested in performing ordinary least squares
regression of YVAR regressed onto XVAR for each of 1000 individual units where each
unit has the following data structure:
case_id YVAR XVAR 1 114 126 1 125 93 1 86 80 1 100 84 1 109 122 2 . . 2 . . . etc. . . . . 1000 112 109 1000 115 103
This data is used as input for the SPSS procedure REGRESSION. If
the SPLIT FILE command is used with the case_id' as the grouping
variable before using the REGRESSION procedure, we will get regression
output for each of the 1000 units. Once this listing output has been
saved into a text file (for example - regress.out), we can read this
text file back in as a data file:
SET WIDTH=80. FILE TYPE NESTED FILE='regress.out' RECORD=1-80 (A). RECORD TYPE case_id:'. DATA LIST / case 14-18. RECORD TYPE Multiple R'. DATA LIST / corr 21-27. RECORD TYPE XVAR'. DATA LIST / slope 16-23. RECORD TYPE (Constant)'. DATA LIST / intercept 15-23. RECORD TYPE Durbin-Watson'. DATA LIST / durbin 23-30. END FILE TYPE.
FORMATS case (F4.2) corr (F6.5) slope (F8.6) intercept (F8.6)
durbin (F6.5).
LIST variables=case corr slope intercept durbin.
This syntax above causes the current working file to be replaced
with the following variables and data cases:
case corr slope intercept durbin 1 .249 .340 72.427 2.863 . . . . . 1000 . . . . etc.
The SPSS command FILE TYPE NESTED defines a file in which
the record types are related to each other hierarchically. In the
present example, the last record type defined is the lowest level
of the hierarchy; this defines a case. The RECORD subcommand defines
the record-identification variable and its column location(s) in the
data. Once the data of interest have been extracted, the working
file can be saved for subsequent analyses.
Next Article
If you have any problems or questions about this server, contact us as
soon us as soon as possible. You can send mail to the following address:
www@unt.edu