* Encoding: UTF-8. * creating the CES-D depression scale. freq fltdpr to cldgng. SORT CASES cldgng (A). AUTORECODE VARIABLES=cntry /INTO country /PRINT. USE ALL. COMPUTE filter_$=(country ne 1). VARIABLE LABELS filter_$ 'country ne 1 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMATS filter_$ (f1.0). FILTER BY filter_$. EXECUTE. COUNT missdep=fltdpr flteeff slprl wrhpp fltlnl enjlf fltsd cldgng(7 thru 9). *alternative syntax. COUNT missdep to cldgng (7 8 9). freq missdep. COMPUTE enjlf2=5-enjlf. compute wrhpp2 = 5-wrhpp. VARIABLE LABELS enjlf2 "enjlf reverse coded". VARIABLE LABELS wrhpp2 "wrhpp reverse coded". VALUE LABELS enjlf2 wrhpp2 1 "All or almost all of the time" 2 "Most of the time" 3 "Some of the time" 4 "None or almost none of the time". freq enjlf2 wrhpp2. cross enjlf2 by enjlf. cross wrhpp2 by wrhpp. compute depress = sum.7(fltdpr, flteeff, slprl, fltlnl, fltsd, cldgng, enjlf2, wrhpp2). if (missdep = 1) depress = (8/7)*depress. freq depress. freq depress /histogram. DESCRIPTIVES depress. /save. freq zdepress /histogram. compute depress10 = (depress-8)/2.4. freq depress10. means depress10 by cntry by gndr. *select countries from ESS6 that also participated in ESS3 and check result. recode country (2 thru 5, 7 thru 15, 20 thru 28 = 1) (ELSE = 0) into country0612. cross cntry by country0612. *select countries from ESS3 that also participated in ESS6 and check result. *NB make sure you are using the right dataset: ESS3. AUTORECODE VARIABLES=cntry /INTO country /PRINT. recode country (1 = 0) (ELSE = 1) into country0612. cross cntry by country0612. *run the following syntax on both datasets. USE ALL. COMPUTE filter_$=(country0612 eq 1). VARIABLE LABELS filter_$ 'country0612 = 1 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FILTER BY filter_$. *repeat the relevant syntax written for ESS6 on ESS3 to create the 'depress' variables . *open the SPSS data file that you created from the data and syntax files that you downloaded from the GSS site. freq age to wrkbaby. MISSING VALUES age (99) educ (98 99) wrkbaby (0 9). WEIGHT by wtssall. CROSSTABS wrkbaby by sex by year /cells = count column /count round cell. MEANS age by year by sex by wrkbaby /CELLS = mean stddev. *exercises. compute popweight = (pspwght*pweight). MEANS TABLES=depress10 BY agea /CELLS=MEAN COUNT STDDEV. GRAPH /LINE(SIMPLE)=MEAN(depress10) BY agea. freq ppltrst, pplfair, pplhlp. compute trust= mean.2(ppltrst, pplfair, pplhlp). recode trust (0 thru 3.67 = 1) (4 thru 6 = 2) (6.3 thru 10 = 3) into trust1. means depress10 by trust1. FREQUENCIES VARIABLES=trust /HISTOGRAM /ORDER=ANALYSIS. CORRELATIONS /VARIABLES=trust Zdepress /PRINT=TWOTAIL NOSIG /MISSING=PAIRWISE. NONPAR CORR /VARIABLES=trust Zdepress /PRINT=SPEARMAN TWOTAIL NOSIG /MISSING=PAIRWISE. MEANS TABLES=depress10 BY mnactic /CELLS=MEAN COUNT STDDEV. compute happyjm = (happy + 2.5 *wrhpp)/2. freq happyjm. FREQUENCIES VARIABLES=happyjm /NTILES=4 /STATISTICS=STDDEV MEAN MEDIAN /HISTOGRAM /ORDER=ANALYSIS. *open the SPSS data file that you created from the data and syntax files that you downloaded from the GSS site. Check that the data is weighted by wtssall freq race. CROSSTABS /TABLES=WRKBABY BY RACE /FORMAT=AVALUE TABLES /STATISTICS=CHISQ /CELLS=COUNT COLUMN /COUNT ROUND CELL. *downlod an extract with teh rwrkbaby variable and create an spss data file. MISSING VALUES age (99) educ (98 99) wrkbaby (0 9). WEIGHT by wtssall. freq rwrkbaby. missing values rwrkbaby (0 8 9). cross rwrkbaby by year sex. CROSSTABS /TABLES=WRKBABY BY RWRKBABY /FORMAT=AVALUE TABLES /STATISTICS=CHISQ /CELLS=COUNT COLUMN /COUNT ROUND CELL. USE ALL. COMPUTE filter_$=(SEX =2). VARIABLE LABELS filter_$ 'SEX =2 (FILTER)'. VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'. FORMATS filter_$ (f1.0). FILTER BY filter_$. EXECUTE. freq educ. recode educ (lo thru 11 = 1) (12 = 2) (13 thru 20 = 3) (ELSE = SYSMIS) into educjm. freq educjm. CROSSTABS /TABLES=WRKBABY BY educjm /FORMAT=AVALUE TABLES /CELLS=COUNT COLUMN /STATISTICS=CHISQ /COUNT ROUND CELL. use all.