Quick How to Guide to SPSS Syntax
Customizing SPSS Environment
� Changing page length to indefinite: SET LENGTH NONE.
Programming Errors
� Setting error listing on, maximum number of error messages displayed, turns on the display of warning messages for undefined data: SET ERRORS ON / MXWARNS =100 / UNDEFINED = WARN.
Documenting a Data File
� Displaying Document: DISPLAY DOCUMENTS.
� Dropping Document: DROP DOCUMENTS.
� Adding Document Data: DOCUMENT This file���.completed on August 20, 2002.
Reading Raw Data in SPSS
� Pathname Mac: Macintosh HD:Users:Desktop:Sarah:TimeSeries:data1.sav.
� Pathname Windows: C:\Documents and Settings\Users 01\Desktop\Time Series\data1.sav.
Reading SPSS System and Portable Files
� Getting, keeping, dropping, renaming:
o GET FILE = base1 / DROP = var1 var2 var3.
o GET FILE = base1 / KEEP var4 var5 var7.
o GET FILE = base1 / RENAME age = age1 grade = grade1.
o GET FILE = data1 / KEEP = v4 v3 v2 v1.
? This command reorders the sequence of variables in the file
? Utlize the / MAP command to produce a table of variables in the active file and the corresponding variables in the system file.
Inspecting a Data File
� Display complete data dictionary: DISPLAY DICTIONARY / VAR = standard
� Frequencies, Notable (request bar chart): FREQ VAR = age / FORMAT = NOTABEL / STATS = MEAN STDDEV SKEW SESKEW.
� Examine allows for explore of variable: EXAMINE VAR = var1.
� Create z scores & save to temp file: DESCR VAR = var1 SAVE. TEMP.
� SORT CASES BY class. SAVE OUTFILE = ind. *Compute the mean grade within each class. AGGREGATE OUTFILE = * / BREAK = class / meangrade = MEAN(grade). SAVE OUTFILE = agg. *Match the two files. MATCH FILES FILE = ind. / TABLE = agg / BY class. LIST VAR = ALL
o The aggregate command calculates the mean grade within each class and saves it in the file agg. The match files command matches the two files so each record includes the mean grade (this is a table look up match); identified by the table subcommand from which the program looks up the correct values of the group level variable for each individual case. List command lists results.
o The BY subcommand is not used the files will be concatednated (all cases from the first fill will appear in the combined file, followed by all cases from the second file. If the BY subcommand is used, the fiels will be interleaved, so the cases in the combined file will be ordered byy their values on the BY variables.
Data File Management
� Sort cases by ascending, descending: SORT CASES BY id (A) date1 (D).
� To filter cases: FILTER BY gender. FILTER OFF.
� Weights: SHOW WEIGHT. WEIGHT OFF. WEIGHT BY wtvar.
âÂ?¢ Select if: SELECT IF (gender = ‘M’). CROSSTABS race by educ. CROSSTABS race by educ.
o The first crosstabs includes males only, while second command does both men and women.
� Splitting a data set: SORT CASES BY gender. SPLIT FILE BY gender. REGRESSION VARS = y x1 x2 x3 x4 x5 x6 / DEPENDENT = y / METHOD = ENTER. SPLIT FILE OFF.
o Performs regression twice, once for men, and once for women. Split file tells SPPS to treat two types of cases separately without actually creating a new file.