340 likes | 411 Views
Learn how to recode variables, create new variables, and use SPSS command syntax in drug abuse data analysis. Explore recode approaches and compute new variables for effective data management.
E N D
GAP Toolkit 5Training in basic drug abuse data management and analysis Training session 7 SPSS: Recode and Compute
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
Types of recode • A categorical variable into a new set of categories • A continuous variable into a categorical variable
Recode approaches • Into pre-defined categories of interest • Into categories of equal size
Example: pre-defined categories • Recode weekly expenditure on drugs into the following categories: • Low expenditure <= £100 a week • High expenditure >= £101 a week
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)
Compute • Creates new variables using: • Standard mathematical operators • A full range of functions • Conditional statements
Transform/Compute click here to define variable type
Explore: Yexpend Descriptives
Example 2: Age • Convert date of birth to age in years
Explore: Age Descriptives
Help • Context-sensitive Help: • Right click on any part of a dialogue box to obtain help • Dialogue box Help button
Command language • Command-line rather than Windows interface • More flexible • Reusable • Saved as text files
Syntax window • Enter SPSS commands: • Type directly • Paste from a dialogue box • Run SPSS commands • Save as a text file
The Paste button click to copy command into Syntax Window
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 Summary