300 likes | 404 Views
Part 4 Syntax or point-and-click?. British Social Attitudes 1986 Q.114, page 43b. Open blank data file. Open a new syntax file and write:. title 'Page 43b of BSA 1986'. data list file 'f:bsa86.dat' records 23 /15 v1508 8-9 v1510 10 v1511 11 v1512 12-13.
E N D
Open a new syntax file and write: title 'Page 43b of BSA 1986'.data list file 'f:bsa86.dat' records 23 /15 v1508 8-9 v1510 10 v1511 11 v1512 12-13.
SPSS reports how data will be read Page 43b of BSA 1986 Data List will read 23 records from F:\bsa86.dat Variable Rec Start End Format V1508 15 8 9 F2.0 V1510 15 10 10 F1.0 V1511 15 11 11 F1.0 V1512 15 12 13 F2.0
Now write: missing values v1508 v1512 (98,99) v1510 (8,9). var labels v1508 'Q105a Household size‘ v1510 'Q105b Marital status‘ v1511 'Q106a Sex of respondent‘ v1512 'Q106b Age of respondent last birthday'. value labels v1510 1 'Married‘ 2 'Living together‘ 3 'Sep or div‘ 4 'Widowed‘ 5 'Not married' 8 'DK' 9 'N/A‘ /v1511 1 'Men' 2 'Women'. save out 'f:page43b.sav'.
and Label and Values columns page43b.sav has also been saved to drive f:
Utilities… Variableslets you slide up and down, but that's all
Utilities… File info..sends (too much) file information to output
V2018 V2019 V2020 V2021 V2022 V2023 2 2 4 4 4 4 4 4 4 4 4 4 1 2 3 4 4 3 1 2 3 2 4 3 2 2 3 8 4 8 Number of cases read: 5 Number of cases listed: 5 list list v2018 to v2023 /cases 5.
UsingCOMPUTEto generate groups • Instead of using IF or DO IF… END IF… • Use compute and recode • Check frequencies • Run crosstab • Compute newvar=var1*10 + var2 • Recode into desired groups
Bloomsbury and Islington Health and Lifestyle survey 1988 Check frequencies and run a crosstab with: freq var v670 v715. cro v715 by v670.
Create new variable with: compute famstat=v670*10+v715.recode famstat (21 24 25 26=1) (22 23=2) (11 14 15 16=3)(12 13=4) (else=sysmis).value labels famstat 1 'Single: no kids' 2 'Couple: no kids' 3 'Single: + kids' 4 'Couple: + kids'.freq var famstat.
Using COMPUTE to recode • To reverse values on items in a scale • Add 1 to the highest code value • Subtract the item value from this figure • eg: Agree – Disagree scale coded 1-5 • Subtracting the item value from 6 reverses it
Using MEANS to get % • Choose a value or values to investigate • Recode these to 100 and everything else to zero • Run MEANS • The figures are percentages and the row totals are the base n