Professional Documents
Culture Documents
1
SPSS
PRO CON
Easy to learn and use Very expensive
Figure 7a. Use of data analysis software in academic publications as measured by hits on Google Scholar.
SPSS Windows has 3 windows:
Data Editor
Data View window, which displays data from the active file in
spreadsheet format
6
SPSS Data View
7
SPSS Variable View
8
SPSS Menu & Toolbars
1. Click this
Window
13
The Workspace
Variables
Value labels
Cases
Toggle between
Data and Variable
Views
14
Enter cases
Under Data
View
15
2. Import from other software
Example: Reading in Data from Excel to SPSS
• Two options:
17
Reading in Data from Excel to SPSS
Warning:
21
General guidelines…
• All data for a project should be in one spreadsheet.
22
General guidelines…
23
General guidelines…
• Do not leave blanks for no.
•Do not enter “?”, “*”, or “NA” for missing data because this
indicates to the statistical program than the variable is a string
variable.
• Put ordinal variables into one column if they are mutually exclusive
Avoid: Preferred:
Pain Pain
Mild Moderate Severe
1 0 0 1
0 1 0 2
0 0 1 3
24
Data merging in SPSS – Adding Variables
It a way of merging or joining two or more data set
into a single data set
• Used when data files have same records but different variables
26
Data merging…
1. Make sure that both files are sorted by Key variable in ascending order
2. In SPSS, open Data from one of the data source
3. Select Add Variables under Data, Merge Files
27
Data merging…
4. Select the dataset you want to merge into the working file.
28
Data merging…
5. Click on Match cases on key variables in sorted files,
6. Click on Both files provide cases
7. Highlight ID in the excluded variables box, then click ► near key
Variables
29
Note in Data merging in SPSS
• Cases must be sorted in the same order in both data files.
• If one or more key variables are used to match cases, the two data
files must be sorted by ascending order of the key variable.
• Variable names in the second data file that duplicate variable names
in the working data file are excluded by default because Add
Variables assumes that these variables contain duplicate information.
•Thus before you merge data files, you need carefully to check two
variables with the same name.
30
Concatenating or appending data in SPSS
This is merging data that was entered into two
different data set
31
Top to Bottom Merge
• Used when data files ID Var1 Var2 var3
33
Recoding existing variables
• We want to use numeric coding for group instead of A
and B.
Old New
ID Group Group
1 A 0
2 A 0
3 B 1
4 B 1
34
Recoding existing variables (2)
From SPSS dialog box, go to:
Transform
Recode
Into Same variables
35
Recoding existing variables (3)
1. Select Group from the variable box into String Variables box
2. Click on Old and new Values to proceed
36
Recoding existing variables (4)
1. Type the old value and the new value you want to convert into
2. Click on Add (To remove, or change, click on Change or Remove)
3. Type all values in the Old New box, then click Continue
4. Click OK to execute the commands.
37
Re-coding existing variables – into the different variable
• Recoding into a different variable transforms an
original variable into a new variable.
•That is, the changes do not overwrite the original variable; they are
instead applied to a copy of the original variable under a new name.
38
Re-coding existing variables – into the different variable
• The Recode into Different Variables window will
appear.
39
Re-coding existing variables ….
Input Variable -> Output Variable: The center text box lists the
variable(s) you have selected to recode, as well as the name your
new variable(s) will have after the recode. You will define the new
name in (C).
Output Variable: Define the name and label for your recoded
variable(s) by typing them in the text fields. Once you are finished,
click Change. Now the center text box, (B), will display both the
name of the original variable as well as the name for the new
variable (e.g., “Height --> Height_categ”).
Old and New Variables: Click the Old and New Values to
specify how you wish to recode the values for the selected variable.
If: The If option allows you to specify the conditions under which
your recode will be applied.
40
Re-coding existing variables ….
Old and New Values
Once you click Old and New Values, a new window where you will
specify how to transform the values will appear.
41
Re-coding existing variables ….
Old Value: Specify the type of value you wish to recode (e.g., a
specific value, missing data, or a range of values) and the specific
value to be recoded (e.g., a value of “1” or a range of “1-5”).
New Value: Specify the new value for your variable (i.e., a specific
numeric code such as “2,” system-missing, or copy old values).
Old -> New: Once you have selected the old and new values for
your selected variable in (1) and (2), click Add in area (3), Old--
>New.
• The recode that you have specified now appears in the text field.
• If you need to change one of the recodes that you have added to
the Old-->New area section, simply click on the one you wish to
change and make changes in (1) and (2) as necessary.
42
Creating a new variable for Diastolic blood pressure (DiasBP):
In SPSS, go to Variable View,
Then type DiasBP at the last row under Name
Go back to Data View and directly type diastolic blood pressure to separate from
SysBP. For ease of data entry, you can move DiasBP right after SysBP. Now also
edit sysBP.
43
Creating new variable from existing variables
• Sometimes you may need to compute a new variable
based on existing information (from other variables) in
your data.
45
Creating new variable from …
The Compute Variable window will open where you will specify how to
calculate your new variable.
46
Target Variable: The name of the new variable that will be
created during the computation.