Part 4 Syntax or point-and-click?. British Social Attitudes 1986 Q.114, page 43b.

30
Part 4 Syntax or point-and-click?

Transcript of Part 4 Syntax or point-and-click?. British Social Attitudes 1986 Q.114, page 43b.

Part 4Syntax 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.

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

SPSS reports how data will be read

Data editor fills Name Type Width and Decimals

columns

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'.

Now write:

missing values v1508 v1512 (98,99) v1510 (8,9).

Data editor fillsMissing column

and Label and Values columns

page43b.sav has also been saved to drive f:

Adjust column widths to see what you've got

What's in the file?

Utilities… Variableslets you slide up and down, but that's all

Utilities… File info.. sends (too much) file information to output

What point-and-click

can’t do

display.

display labels.

display variables.

 

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.

A useful trick

Using COMPUTE to 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

freq var v670 v715.

cro v715 by v670.

Check frequencies and run a crosstab with:

V670 RESPONSIBLE FOR CHILDREN

432 30.6 30.6 30.6

953 67.5 67.5 98.2

26 1.8 1.8 100.0

1411 100.0 100.0

1 Yes

2 No

3

Total

ValidFrequency Percent Valid Percent

CumulativePercent

V715 MARITAL STATUS

526 37.3 37.5 37.5

467 33.1 33.3 70.8

73 5.2 5.2 76.0

50 3.5 3.6 79.5

122 8.6 8.7 88.2

160 11.3 11.4 99.6

5 .4 .4 100.0

1403 99.4 100.0

8 .6

1411 100.0

1 SINGLE

2 MARRIED

3 COHABITING

4 SEPARATED

5 DIVORCED

6 WIDOWED

7 OTHER

Total

Valid

SystemMissing

Total

Frequency Percent Valid PercentCumulative

Percent

Frequency count for component variables

Intermediate crosstab

V715 MARITAL STATUS * V670 RESPONSIBLE FOR CHILDREN Crosstabulation

Count

88 422 16 526

234 228 5 467

30 43 73

23 27 50

46 75 1 122

10 147 3 160

5 5

431 947 25 1403

1 SINGLE

2 MARRIED

3 COHABITING

4 SEPARATED

5 DIVORCED

6 WIDOWED

7 OTHER

V715 MARITALSTATUS

Total

1 Yes 2 No 3

V670 RESPONSIBLE FORCHILDREN

Total

 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.

FAMSTAT

671 47.6 48.9 48.9

271 19.2 19.7 68.6

167 11.8 12.2 80.8

264 18.7 19.2 100.0

1373 97.3 100.0

38 2.7

1411 100.0

1 Single: no kids

2 Couple: no kids

3 Single: + kids

4 Couple: + kids

Total

Valid

SystemMissing

Total

Frequency Percent Valid PercentCumulative

Percent

Frequency count for new variable

Another useful trick

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

And one more

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

…and now

Let Battle Begin!