How to Import a Text Data File Using SPSS Import Statements
Based on SPSS v24
This support document is designed to assist data users with importing text data into SPSS using the NDACAN
provided import statements. This document assumes the data user has already downloaded and saved the data
files from the secure file transfer system to their local computer or institutions network location (if permitted).
The file containing the import statement will end in .sps. The file containing the text data will end in .dat.
Below, is an example of how the import statement will be organized followed by instructions for which parts of
the syntax you will need to modify.
Example of an import statement from the RPG-2 dataset:
/* The following line should contain the complete path and name of your raw data file */
/* The last line of this file contains the path to your output '.sav' file */
DATA / NAME="c:\temp\DS_218_RPG_2\Data\OAISIS\Text_data\rpg_cbcl.dat" LRECL=37 FILE HANDLE
.
FILE=DATA/DATA LIST
Grantee_ID 1-2 CASE_ID 3-8 (A) IND_ID 9-14 (A)
RPG_TIMEPOINT 15 CBCL_BL_VALID 16 (A) CBCL_EXT_RI 17 (A)
CBCL_INT_RI 18 (A) CBCL_TOT_RI 19 (A)
CBCL_EXTERNAL_NORM 20-21 (A) CBCL_INTERNAL_NORM 22-23 (A)
CBCL_TOTPROB_NORM 24-25 (A) CBCL_WGT 26-37 (A) .
VARIABLE LABELS
Grantee_ID 'GID'
CASE_ID 'Case id number'
IND_ID 'Individual id number'
RPG_TIMEPOINT 'Time period assessment was administered (baseline / followup)'
CBCL_BL_VALID 'Baseline eligibility indicator'
CBCL_EXT_RI 'High risk indicator - external / behavior problems'
CBCL_INT_RI 'High risk indicator - internal / behavior problems'
1
CBCL_TOT_RI 'High risk indicator - total problems'
CBCL_EXTERNAL_NORM 'Norm score - external / behavior problems'
CBCL_INTERNAL_NORM 'Norm score - internal / emotional problems'
CBCL_TOTPROB_NORM 'Norm score - total problems'
CBCL_WGT 'Weight, after trimming' .
VALUE LABELS
RPG_TIMEPOINT
1 'baseline'
2 'followup' /
CBCL_BL_VALID
'0' 'baseline assessment did NOT occur within the expected range'
'1' 'baseline assessment occurred within the expected range' /
CBCL_EXT_RI
'0' 'child does NOT meet the threshold for emotional-internalizing problems'
'1' 'child does meet the threshold for emotional-internalizing problems'
'M' 'Item Non-response' /
CBCL_INT_RI
'0' 'child does NOT meet the threshold for behavioral-externalizing problems'
'1' 'child does meet the threshold for behavioral-externalizing problems'
'M' 'Item Non-response' /
CBCL_TOT_RI
'0' 'child does NOT meet the threshold for total problems'
'1' 'child does meet the threshold for total problems'
'M' 'Item non-response' /
CBCL_EXTERNAL_NORM CBCL_INTERNAL_NORM CBCL_TOTPROB_NORM
'M' 'Item Non-response' / .
SAVE OUTFILE='c:\temp\DS_218_RPG_2\Data\OAISIS\Text_data\rpg_cbcl.sav'.
Step one: Data users need to update the FILE HANDLE statement with the file path location of the text data
file (.dat) stored on their computer or network location. The text data file will share the same file name as the
2
rpg_cbcl.spsimport statement file name. In this example, the name of the import statement we are using, is
which means the corresponding text data file will be name rpg_cbcl.dat.” Below, is the line of syntax from the
import statement file which would require updating.
FILE HANDLE DATA / NAME="c:\temp\DS_218_RPG_2\Data\OAISIS\Text_data\rpg_cbcl.dat" LRECL=37
.
To update the FILE HANDLE statement, paste or type out the file path location of the text data file (.dat file
-quotes and that the FILE HANDLE line extension) between the double-quotes. Be sure to preserve the double
ends in a period. As shown in this step, the period was dropped down to a separate line due to space constraints
related to the formatting of the margins in this document.
Step Two: Data users need to update the SAVE OUTFILE statement with the file path location of where they
would like to store the resulting SPSS native file (.sav file extension) that is produced after running the import
statement. Below, is the line of syntax from the import statement file which will require updating.
OUTFILE='c:\temp\DS_218_RPG_2\Data\OAISIS\Text_data\rpg_cbcl.sav'. SAVE
To update the SAVE OUTFILE statement, paste or type out the file path of the location to where you would
like to store your resulting SPSS native file. The file path should be placed between the single quotes.
entirety of the import statement file and run the syntax. The text data should now Step Three: Highlight the
appear in your SPSS Data View window and be saved as a “.sav” file with the file name provided in the SAVE
OUTFILE statement.
This concludes the instructions on how to import a text data file using SPSS import sta
3
tements. Please submit
questions to [email protected].