Download presentation
Presentation is loading. Please wait.
Published byClarence Milo Tyler Modified over 9 years ago
1
GAP Toolkit 5 Training in basic drug abuse data management and analysis Training session 7 SPSS: Recode and Compute
2
Objectives 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
3
Types of recode A categorical variable into a new set of categories A continuous variable into a categorical variable
4
Recode approaches Into pre-defined categories of interest Into categories of equal size
5
Example: pre-defined categories Recode weekly expenditure on drugs into the following categories: –Low expenditure <= £100 a week –High expenditure >= £101 a week
7
select variable for recoding and click
9
click here to map old new values
12
FrequencyPercentValid percent Cumulative percent ValidLow3162.0 High1938.0 100.0 Total50100.0 Weekly drug expenditure
13
Example: 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)
15
FrequencyPercentValid percentCumulative percent Valid<=£901224.0 £91 <= X <= £981224.0 48.0 £99 <= X <= £1051326.0 74.0 £106 = £1161326.0 100.0 Total50100.0 NTILES of Expend
16
FrequencyPercentageValid percentageCumulative percentage Valid1510.0 248.0 18.0 3714.0 32.0 448.0 40.0 548.0 48.0 6612.0 60.0 7510.0 70.0 8510.0 80.0 9612.0 92.0 1048.0 100.0 Total50100.0 NTILES of EXPEND
17
Compute Creates new variables using: –Standard mathematical operators –A full range of functions –Conditional statements
18
Transform/Compute click here to define variable type
19
Type and Label
20
Yexpend=Expend*52
21
Explore: Yexpend StatisticStd. error Yearly drug expenditureMean5062.7277.468 95% Confidence Interval for Mean Lower Bound4907.04 Upper Bound5218.40 5% Trimmed Mean5072.89 Median5148.00 Variance300062.3 Std. Deviation547.779 Minimum3848 Maximum6032 Range2184 Interquartile Range754.00 Skewness-.333.337 Kurtosis-.446.662 Descriptives
22
Example 2: Age Convert date of birth to age in years
23
(DATE.DMY(01,01,2002) - dob) / (365.25*24*60*60)
24
Explore: Age StatisticStd. error AGEMean25.431.219 95% Confidence Interval for Mean Lower Bound22.97 Upper Bound27.88 5% Trimmed Mean25.21 Median22.84 Variance72.867 Std. Deviation8.536 Minimum11 Maximum44 Range32 Interquartile Range12.77 Skewness.579.340 Kurtosis-.518.668 Descriptives
25
Help Context-sensitive Help: –Right click on any part of a dialogue box to obtain help Dialogue box Help button
28
Command language Command-line rather than Windows interface More flexible Reusable Saved as text files
29
Syntax window Enter SPSS commands: –Type directly –Paste from a dialogue box Run SPSS commands Save as a text file
30
The Paste button click to copy command into Syntax Window
32
The Run menu
33
Syntax for Age
34
Summary 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.