How to Bring an ASCII Data File into SPSS
THE BEST WAY TO APPROACH THIS TASK
We will focus on “determining the appropriate SPSS Syntax file needed” and “creating the required SPSS Syntax file”. ASCII DATA FILESASCII data files are often referred to as "text" files or "plain text" files. They contain no formatting information--just rows of characters. The “mapping” information for the characters comes from the codebook discussed in step one above. Two types
Is the ASCII Single Record or Multi-Record?
BRINGING ASCII DATA INTO SPSSSPSS Syntax File Since no structure is included in an ASCII data file, an SPSS syntax file (also known as a setup file) must be created to instruct the software on where to go to get particular variables (questions). SPSS Commands That Every SPSS Syntax File Should Have
Example of a Single Record SPSS Syntax File (complete sample below)/* this program reads a single record data file */
file handle indata1 /name="C:\temp\abcw887.dat".
data list file=indata1 records=1
/1
Q08 50-51
Sex 98-99.
Variable Labels
Q08 "FBI Monitoring"
Sex "Gender of respondent".
Value Labels
Q08 1 "Support" 2 "Oppose" 8 "DK" 9 "NA-Refused" /
Sex 1 "Male" 2 "Female" /.
Execute.
SPSS Syntax Rules
Run the Syntax FileHighlight all of the syntax file text and click the
Example of Multi-Record SPSS Syntax File (complete sample below)/* this program reads a multiple record data file */
file handle datain1 /name="C:\temp\mult102.dat".
data list file=datain1 records=4
/1
Q01a 6(a)
Q01b 7(a)
/2
Q22 8-9
/3
Sex 28
/4
PartyID 57.
Execute.
Tips & Troubleshooting
Complete SPSS Syntax Files with ASCII Data File and Codebook
ADDITIONAL SPSS RESOURCES
|