SPSS SYNTAX CODES –Keyed to de Vaus
Chapters
*Chapter 3*.
*Uses CRIC 2002 Charter Data*.
*Basic Recodes*.
recode q13 (1=4) (2=3) (3=2) (4=1)
into Chrtgood.
value labels Chrtgood 1 'vbad' 2 'bad' 3 'good' 4 'vgood'.
recode q37 (1=2) (2=1) into Chrtunit.
value labels Chrtunit 1 'divide' 2 'unite'.
*Using deviation coding*.
recode q16a (1= -1)(2=0)(3=1) into
ChrtMin.
recode q16b (1= -1)(2=0)(3=1)into ChrtCan.
recode q16c (1= -1)(2=0)(3=1)into ChrtWom.
recode q16d (1= -1)(2=0)(3=1)into ChrtCrim.
value labels ChrtMin ChrtCan ChrtWom ChrtCrim -1 'too far' 0 'just enough' 1
'not enough' .
*Using dichotomous coding*.
recode q16a (1,2=1) (3=2) into
ChrtMin2.
recode q16b (1,2=1) (3=2) into ChrtCan2.
recode q16c (1,2=1) (3=2) into ChrtWom2.
recode q16d (1,2=1) (3=2) into ChrtCrm2.
value labels ChrtMin2 ChrtCan2 ChrtWom2 ChrtCrm2 1 'too far or not enough' 2
'just enough'.
*Cohen's Kappa - "not of much use" per deVaus p19*.
CROSSTABS TABLES=ChrtMin BY ChrtWom
/FORMAT=NOTABLES
/STATISTIC=KAPPA
/COUNT ROUND CELL .
*Inter-item Correlations -Using taub in lieu of Pearson's r*.
NONPAR CORR VARIABLES=ChrtMin
ChrtCan ChrtWom ChrtCrim
/PRINT=KENDALL TWOTAIL SIG
/MISSING=PAIRWISE .
*Reliability Analyses*.
*Using deviation coding*.
RELIABILITY
/VARIABLES= Chrtgood Chrtunit ChrtMin ChrtCan ChrtWom
/SCALE(ALPHA)=ALL/MODEL=ALPHA
/STATISTICS=DESCRIPTIVE
/SUMMARY=TOTAL .
*Using dichotomous coding*.
RELIABILITY
/VARIABLES=Chrtgood Chrtunit ChrtMin2 ChrtCan2 ChrtWom2 ChrtCrm2
/SCALE(ALPHA)=ALL
/MODEL=ALPHA
/STATISTICS=DESCRIPTIVE
/SUMMARY=TOTAL .
*Split-Halves Method*.
RELIABILITY
/VARIABLES=Chrtgood Chrtunit ChrtMin ChrtCan ChrtWom ChrtCrim
/SCALE(SPLIT)=ALL/MODEL=SPLIT.
*Cronbach's Alpha*.
RELIABILITY
/VARIABLES=Chrtgood Chrtunit ChrtMin ChrtCan ChrtWom ChrtCrim
/SCALE(ALPHA)=ALL/MODEL=ALPHA
/SUMMARY=TOTAL .
* de Vaus Chapter 4*.
*Correlation Matrix-- again using taub in lieu of r*.
NONPAR CORR
/VARIABLES=Chrtgood Chrtunit ChrtMin ChrtCan ChrtWom ChrtCrim
/PRINT=KENDALL TWOTAIL SIG
/MISSING=PAIRWISE .
deVaus Chapters 5, 6, 8,
9, 28, 30, 32 & 36.
The data source for the following
examples is the
Q44. What was the total income BEFORE taxes of ALL MEMBERS
of your household for 1998. I do not need the exact
amount, just a broad category.
[PAUSE] Was the total household income from all sources…
<1> less than $10,000
<2> $10,000 to less than $20,000
<3> $20,000 to less than $30,000
<4> $30,000 to less than $40,000
<5> $40,000 to less than $50,000
<6> $50,000 to less than $60,000
<7> $60,000 to less than $70,000
<8> $70,000 to less than $80,000
<9> $80,000 to less than $90,000
<10>$90,000 to less than $100,000
<11> or over $100,000
Q18. From what you have heard or read, would you say that
you are very satisfied, somewhat satisfied, not very satisfied or not satisfied
at all with the way the Supreme Court has been working?
<1> Very satisfied
<2> Somewhat satisfied
<4> Not very satisfied
<5> Not satisfied at all
<8> Don’t know
<9> Refused
Chapter 5 Exercises
First, exclude all cases from q44
where respondents said they "don't know" or "refused" (see
Chapter 9). The SPSS syntax is as
follows:
MISSING VALUES q44 (98,99).
SPSS Syntax for Obtaining a
Frequency Table and Cutting Points
FREQUENCIES
VARIABLES=q44
/NTILES= 3 .
SPSS Syntax for Recoding a Variable
RECODE
q44
(1
thru 3=1) (4 thru 5=2) (6 thru 11=3)
INTO income
.
EXECUTE .
Chapter 6 Exercises
Again, exclude all cases from q44
where respondents said they "don't know" or "refused" (see
Chapter 9). The SPSS syntax is as
follows:
missing values q44 (98,99).
SPSS Syntax for Converting Variables
to the Interval Level
RECODE
q44
(1=5000)(2=15000)(3=25000)(4=35000)(5=45000)(6=55000)
(7=65000)(8=75000)(9=85000)(10=95000)(11=105000)
INTO income .
EXECUTE .
Chapter 8 Exercises
SPSS Syntax for Reordering and
Reversing Categories
RECODE
q18
(1=5) (2=4) (4=2) (5=1)
INTO q18rev.
EXECUTE .
Chapter 9 Exercises
SPSS Syntax for Dropping Cases
MISSING VALUES q18 (8,9).
SPSS Syntax for Imputation
RMV
/q18_1=SMEAN(q18).
Chapter 28 Exercises
SPSS Syntax for Producing Frequency
Tables
FREQUENCIES
VARIABLES=q18.
Chapter 30
SPSS Syntax for Descriptive
Univariate Summary Statistics
MISSING VALUES q18 (8,9).
FREQUENCIES
VARIABLES=q18 /FORMAT=NOTABLE
/STATISTICS=
SEKURT.
Chapter 32 & 36
SPSS Syntax for Crosstabs with Nominal & Ordinal Data from CRIC 2002
Crosstabs with Dichotomous Variables (refugees and civil libs)- using phi.
missing values q25 q35 (99).
crosstabs tables = q25 q35 by lang gender
/cells = column count
/statistics = phi.
Additional Dichotomies on porn and hate law from
CRIC 2002
missing values q23_1 q23_2 (88, 99).
crosstabs tables = q23_1 q23_2 by lang gender
/cells = column count
/statistics = phi.
*Multi-nomial independent variables (region &
occup) - uses V*.
missing values q25 q35 (99).
crosstabs tables = q25 q35 by region q43
/cells = column count
/statistics = phi.
Ordinal crosstabs with CRIC 2002 data
using taub & tauc.
missing values q13 q42 (99).
recode q13 (1=4) (2=3) (3=2) (4=1) into chart4.
value labels chart4 1 ' vbad' 2 'bad' 3 'good' 4 'vgood'.
recode q42 (1,2,3=1) (4,5,6 = 2) (7,8=3) into educ.
value labels educ 1 'HS or less' 2 'Some PS' 3 'Univ Grad'.
crosstabs tables = chart4 by educ
/cells = column count
/statistics = btau ctau gamma.
Chapter 39
Syntax for Testing Statistical Significance
Using the 2000 Canadian Election Study
T-Test
missing values PESC3 (998, 999).
fre var=PESC3 PESLANG/.
t-test groups = PESLANG (1, 2)
/variables = PESC3
/criteria = CIN (.99).
One-Way ANOVA
missing values CPSPC (996, 998, 999).
fre var=CPSPC PROVINCE/.
recode PROVINCE (10, 12, 13=1) (24=2) (35=3) (46, 47, 48=4)
(59, 11=5) into region.
value labels region 1'Atlantic' 2'Quebéc' 3'Ontario'
4'Prairies' 5'West'.
fre var= region.
Oneway CPSPC by region (1, 5)
/ranges = scheffe
/statistics = all.
Chi-Square Test
missing values CPSA2D (7, 8, 9).
fre var=CPSA2D CPSM10B/.
recode CPSA2D (1=3) (2=2) (3=1) into famval.
value labels famval 1'not important' 2'smw important'
3'very important'.
recode CPSM10B (1=4) (3=3) (5=2) (7=1) into religion.
value labels religion 1'not at all' 2'not important'
3'important' 4'very important'.
fre var=famval religion/.
crosstab tables = famval by religion
/cells=column count
/statistics = CHISQ ctau.