Spss beginners

  • View

  • Download

Embed Size (px)




  • 1. SPSS for Beginners1

2. What is in this workshop SPSS interface: data view and variable view How to enter data in SPSS How to import external data into SPSS How to clean and edit data How to transform variables How to sort and select cases How to get descriptive statistics2 3. Data used in the workshop We use 2009 Youth Risk Behavior SurveillanceSystem (YRBSS, CDC) as an example. YRBSS monitors priority health-risk behaviors andthe prevalence of obesity and asthma amongyouth and young adults. The target population is high school students Multiple health behaviors include drinking,smoking, exercise, eating habits, etc.3 4. SPSS interface Data view The place to enter data Columns: variables Rows: records Variable view The place to enter variables List of all variables Characteristics of all variables4 5. Before the data entry You need a code book/scoring guide You give ID number for each case (NOT realidentification numbers of your subjects) if youuse paper survey. If you use online survey, you need somethingto identify your cases. You also can use Excel to do data entry.5 6. Example of a code book6A code book is about how you code yourvariables. What are in code book?1.Variable names2.Values for each response option3.How to recode variables 7. Enter data in SPSS 19.07Columns:variablesRows: casesUnder DataView 8. Enter variables81. Click thisWindow1. Click Variable View2. Type variable name underName column (e.g. Q01).NOTE: Variable name can be 64bytes long, and the firstcharacter must be a letter orone of the characters @, #, or$.3. Type: Numeric, string, etc.4. Label: description of variables.2. Typevariable name3. Type:numeric orstring4. Descriptionof variable 9. Enter variables9Based on yourcode book! 10. Enter cases10Under DataView1. Two variables in the data set.2. They are: Code and Q01.3. Code is an ID variable, used to identify individual case(NOT peoples real IDs).4. Q01 is about participants ages: 1 = 12 years oryounger, 2 = 13 years, 3 = 14 years 11. Import data from Excel Select File Open Data Choose Excel as file type Select the file you want to import Then click Open11 12. Open Excel files in SPSS12 13. Import data from CVS file CVS is a comma-separated values file. If you use Qualtrics to collect data (onlinesurvey), you will get a CVS data file. Select File Open Data Choose All files as file type Select the file you want to import Then click Open13 14. Continue14 15. Continue15 16. Continue16 17. Continue17 18. Continue18 19. Continue19 20. Continue20Save this fileas SPSS data 21. Clean data after import data files Key in values and labels for each variable Run frequency for each variable Check outputs to see if you have variableswith wrong values. Check missing values and physical surveys ifyou use paper surveys, and make sure theyare real missing. Sometimes, you need to recode stringvariables into numeric variables21 22. Continue22Wrongentries 23. Variable transformation Recode variables231. Select Transform Recodeinto Different Variables2. Select variable that you wantto transform (e.g. Q20): wewant1= Yes and 0 = No3. Click Arrow button to putyour variable into the rightwindow4. Under Output Variable: typename for new variable andlabel, then click Change5. Click Old and New Values 24. Continue6. Type 1 under Old Valueand 1 under New Value,click Add. Then type 2under Old Value, and 0under New Value, clickAdd.7. Click Continue afterfinish all the changes.8. Click Ok24 25. Variable transformationCompute variable (use YRBSS 2009 data)Example 1. Create a new variable: drug_use (During the past 30days, any use of cigarettes, alcohol, and marijuana is defined asuse, else as non-use). There are two categories for the newvariable (use vs. non-use). Coding: 1= Use and 0 = Non-use1. Use Q30, Q41, and Q47 from 2009 YRBSS survey2. Non-users means those who answered 0 days/times to all threequestions.3. Go to Transform Compute Variable25 26. Continue4. Type drug_use underTarget Variable5. Type 0 under NumericExpression. 0 meansNon-use6. Click If button.26 27. Continue7. With help of thatArrow button, typeQ30= 1 & Q41 = 1 & Q47= 1then click Continue8. Do the same thing forUse, but the numericexpression is different:Q30> 1 | Q41> 1 | Q47>127AND OR 28. Continue9. Click OK10. After click OK,a small window asksif you want tochange existingvariable becausedrug_use was alreadycreated when youfirst define non-use.11. Click ok.28 29. ContinueCompute variablesExample 2. Create a new variable drug_N thatassesses total number of drugs that adolescents usedduring the last 30 days.1.Use Q30 (cigarettes), 41 (alcohol), 47 (marijuana), and50 (cocaine). The number of drugs used should bebetween 0 and 4.2.First, recode all four variables into two categories: 0 =non-use (0 days), 1 = use (at least 1 day/time)3.Four variables have 6 or 7 categories29 30. Continue4. Recode four variables: 1 (old) = 0 (new), 2-6/7 (old) = 1 (New).5. Then select Transform Compute Variable30 31. Continue6. Type drug_N under Target Variable7. Numeric Expression: SUM (Q30r,Q41r,Q47r,Q50r)8. Click OK31 32. Continue Compute variables Example 3: Convert string variable into numericvariable321. Enter 1 at NumericExpression.2. Click If button and typeQ2 = Female3. Then click Ok.4. Enter 2 at NumericExpression.5. Click If button and typeQ2 = Male6. Then click Ok 33. Sort and select cases Sort cases by variables: Data Sort Cases You can use Sort Cases to find missing.33 34. Sort and select cases Select cases Example 1. Select Females for analysis.1.Go to Data Select Cases2.Under Select: check the second one3.Click If button34 35. Continue4. Q2 (gender) = 1,1 means Female5. Click Continue6. Click Ok35Unselectedcases :Q2 = 2 36. Sort and select cases7. You will see a new variable: filter_$ (Variableview)36 37. Sort and select cases Select cases Example 2. Select cases who used any of cigarettes, alcohol, and marijuanaduring the last 30 days.1. Data Select Cases2. Click If button3. Type Q30 > 1 | Q41 > 1 | Q47 > 1, click Continue37 38. Basic statistical analysis Descriptive statistics Purposes:1.Find wrong entries2.Have basic knowledge about the sample andtargeted variables in a study3.Summarize dataAnalyze Descriptive statistics Frequency38 39. Continue39 40. Frequency table40 41. 411. Skewness: a measure of theasymmetry of a distribution.The normal distribution issymmetric and has a skewnessvalue of zero.Positive skewness: a long right tail.Negative skewness: a long left tail.Departure from symmetry : askewness value more than twiceits standard error.2. Kurtosis: A measure of the extentto which observations cluster arounda central point. For a normaldistribution, the value of the kurtosisstatistic is zero. Leptokurtic datavalues are more peaked, whereasplatykurtic data values are flatter andmore dispersed along the X axis.NormalCurve 42. 42


View more >