Title: GAP%20Toolkit%205%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Training%20in%20basic%20drug%20abuse%20data%20management%20and%20analysis
1GAP Toolkit 5
Training in basic drug abuse data
management and analysis
Training session 7 SPSS Recode and Compute
2Objectives
- To introduce and demonstrate SPSS tools for
recoding variables and creating new variables - To introduce and demonstrate the use of SPSS
command syntax - To introduce and demonstrate Help features in
SPSS from a dialogue box
3Types of recode
- A categorical variable into a new set of
categories - A continuous variable into a categorical variable
4Recode approaches
- Into pre-defined categories of interest
- Into categories of equal size
5Example pre-defined categories
- Recode weekly expenditure on drugs into the
following categories - Low expenditure lt 100 a week
- High expenditure gt 101 a week
6(No Transcript)
7select variable for recoding and click
8(No Transcript)
9click here to map old ? new values
10(No Transcript)
11(No Transcript)
12Weekly drug expenditure
Frequency Percent Valid percent Cumulative percent
Valid Low 31 62.0 62.0 62.0
High 19 38.0 38.0 100.0
Total 50 100.0 100.0
13Example quantiles
- Recode weekly expenditure into the following
- 4 categories, each with approximately the same
number of cases (quartiles) - 10 categories, each with approximately the same
number of cases (deciles)
14(No Transcript)
15NTILES of Expend
Frequency Percent Valid percent Cumulative percent
Valid lt90 12 24.0 24.0 24.0
91 lt X lt 98 12 24.0 24.0 48.0
99 lt X lt 105 13 26.0 26.0 74.0
106 lt X gt 116 13 26.0 26.0 100.0
Total 50 100.0 100.0
16NTILES of EXPEND
Frequency Percentage Valid percentage Cumulative percentage
Valid 1 5 10.0 10.0 10.0
2 4 8.0 8.0 18.0
3 7 14.0 14.0 32.0
4 4 8.0 8.0 40.0
5 4 8.0 8.0 48.0
6 6 12.0 12.0 60.0
7 5 10.0 10.0 70.0
8 5 10.0 10.0 80.0
9 6 12.0 12.0 92.0
10 4 8.0 8.0 100.0
Total 50 100.0 100.0
17Compute
- Creates new variables using
- Standard mathematical operators
- A full range of functions
- Conditional statements
18Transform/Compute
click here to define variable type
19Type and Label
20YexpendExpend52
21Explore Yexpend
Descriptives
Statistic Std. error
Yearly drug expenditure Mean 5062.72 77.468
95 Confidence Interval for Mean Lower Bound 4907.04
Upper Bound 5218.40
5 Trimmed Mean 5072.89
Median 5148.00
Variance 300062.3
Std. Deviation 547.779
Minimum 3848
Maximum 6032
Range 2184
Interquartile Range 754.00
Skewness -.333 .337
Kurtosis -.446 .662
22Example 2 Age
- Convert date of birth to age in years
23(DATE.DMY(01,01,2002) - dob) / (365.25246060)
24Explore Age
Descriptives
Statistic Std. error
AGE Mean 25.43 1.219
95 Confidence Interval for Mean Lower Bound 22.97
Upper Bound 27.88
5 Trimmed Mean 25.21
Median 22.84
Variance 72.867
Std. Deviation 8.536
Minimum 11
Maximum 44
Range 32
Interquartile Range 12.77
Skewness .579 .340
Kurtosis -.518 .668
25 Help
- Context-sensitive Help
- Right click on any part of a dialogue box to
obtain help - Dialogue box Help button
26(No Transcript)
27(No Transcript)
28Command language
- Command-line rather than Windows interface
- More flexible
- Reusable
- Saved as text files
29Syntax window
- Enter SPSS commands
- Type directly
- Paste from a dialogue box
- Run SPSS commands
- Save as a text file
30The Paste button
click to copy command into Syntax Window
31(No Transcript)
32The Run menu
33Syntax for Age
34Summary
- Recode
- Into same variable
- Into different variable
- Compute
- Mathematical operators
- Functions
- Dialogue box Help
- Context-sensitive Help
- Dialogue box Help button
- Command language
- Syntax Window
- Dialogue box Paste button