Download as pdf or txt
Download as pdf or txt
You are on page 1of 46

Chapter 8: Introduction to Statistics with

SPSS

Center for Information Technology and Scientific Computing


Overview
• SPSS environment
• Data view window
• Data creation in SPSS
• Importing Data into SPSS
• Variable in SPSS
• Working with data
• Analyzing data

Research Methodology – Ch. 8 Basics of SPSS 2


Resources
• SPSS Tutorials:
https://libguides.library.kent.edu/SPSS/home
• SPSS Course Manual:
https://www.bioinformatics.babraham.ac.uk/training/SPSS
%20Course%20Manual.pdf

Research Methodology – Ch. 8 Basics of SPSS 3


Introduction
• SPSS - “Statistical Package for the Social Sciences”
• Widely used in many areas
• Straight forward package with a friendly environment
• Easy to access documentation and tutorials are very good
• Requirements
• Users need to make decisions at every stage
• Need to have a basic knowledge of stats

Research Methodology – Ch. 8 Basics of SPSS 4


The SPSS Environment
• SPSS utilizes multiple types of windows or screens
• Each window is associated with specific tasks & types of SPSS files
• Windows
• Data Editor
• Output Viewer
• Syntax Editor
• Pivot Table Editor
• Chart Editor
• Text Output Editor
• Common windows
• Data Editor
• Output Viewer
• Syntax Editor

Research Methodology – Ch. 8 Basics of SPSS 5


Opening SPSS for the first time
• Click on the SPSS icon
• A small window opens, giving you several choices
• Run a tutorial, Type in data …or opening existing SPSS files

Research Methodology – Ch. 8 Basics of SPSS 6


Data Editor Window
• Default window and opens when SPSS starts
• Displays the content of any open data files
• Provides drop-down menus to modify and analyze data
• The data are
displayed in a
spreadsheet format
• Columns represent
variables
• Rows represent
cases

Research Methodology – Ch. 8 Basics of SPSS 7


Data Editor
• The spreadsheet format includes two tabs at the bottom
• Data View tab displays the open data set
• Variables appear in columns, and cases appear in rows
• Variable View tab displays information about variables in the open
data (but not the data themselves), such as variable names, types,
and labels, …
• The tab that is currently displayed will be yellow in color

Research Methodology – Ch. 8 Basics of SPSS 8


Output Viewer
• The Output Viewer window opens automatically when
command is performed
• Displays a log of the actions taken and associated output
• Results of statistical analysis are shown
• Left frame contains an outline of the content in the Output Viewer
• Right frame contains the actual output

Research Methodology – Ch. 8 Basics of SPSS 9


Syntax Editor
• SPSS syntax is a programming language used as an
alternative to the drop-down menus for data manipulation
and statistical analyses
• The Syntax Editor window is where users can write,
debug, and execute SPSS syntax
• To open a new Syntax Editor window: File > New > Syntax

Research Methodology – Ch. 8 Basics of SPSS 10


Overview
• SPSS environment
• Data view window
• Data creation in SPSS
• Importing Data into SPSS
• Variable in SPSS
• Working with data
• Analyzing data

Research Methodology – Ch. 8 Basics of SPSS 11


Reading the Data View Window
• In SPSS, each row in the Data View represents a case,
and each column represents a variable
• Cases represent independent observations, experimental units, or
subjects
• E.g., if the data are based on a survey of college students, then each
row in the data would represent a specific college student who
participated in the study
• Variables are attributes, characteristics, or measurements that
describe cases
• E.g., your data might include information such as each college
student’s date of birth, grade point average (GPA), date of enrollment,
and date of graduation
• Each of these pieces of information is a variable that describes each
case (college student)

Research Methodology – Ch. 8 Basics of SPSS 12


Reading the Data View Window …

Research Methodology – Ch. 8 Basics of SPSS 13


Viewing Multiple Sections of Data Simultaneously
• To split the window, click Window > Split

Research Methodology – Ch. 8 Basics of SPSS 14


Looking Up a Specific Case/Variable
• SPSS provides a way of quickly jumping to specific cases
or variables in your dataset in the Data View window
• Useful option for large datasets that include hundreds of cases and
variables
• Click the Go to case icon or click Edit > Go to Case/variable
• In the Go to case/variable number list, enter the case/variable
number or use the up/down arrows on the right to select the case
number

Research Methodology – Ch. 8 Basics of SPSS 15


Overview
• SPSS environment
• Data view window
• Data creation in SPSS
• Importing Data into SPSS
• Variable in SPSS
• Working with data
• Analyzing data

Research Methodology – Ch. 8 Basics of SPSS 16


Data Creation in SPSS
• To create a new one, click File > New > Data
• You will notice that each of the columns is labeled “var”
• Column names represents variables that you enter in your dataset
• Each row is labeled with a number (“1,” “2,” and so on)
• When you enter values for your data in the spreadsheet cells, each
value will correspond to a specific variable (column) and a specific
case (row)

Research Methodology – Ch. 8 Basics of SPSS 17


Entering Data
• Click Variable View tab
• Type name for your first variable under the Name column
• Enter other information about the variable, such as the type (the
default is “numeric”), width, decimals, label, …
• E.g., Insert variable type “School_Class”
• Include class levels of each student
• 1 = first year, 2 = second year, 3 = third year, and
4 = fourth year)
• Click the Data View tab
• Any variable names that you entered
in Variable View will now be included in the
columns (one variable name per column)
• Now you can enter values for each case (in
this example, cases represent students)
• For each student, enter a value for their
class level
Research Methodology – Ch. 8 Basics of SPSS 18
Inserting or Deleting Single Cases
• To insert a new case into a dataset
• In Data View, click a row number or individual cell below where
you want your new row to be inserted and
• Click Edit > Insert Cases
• Right-click on a row and select Insert Cases from the menu, or
• Click the Insert Cases icon

Research Methodology – Ch. 8 Basics of SPSS 19


Inserting or Deleting Single Variables
• To insert a new variable into a dataset, in the Data View
window, click the name of the column to the right of where
you want your new variable to be inserted
• Click Edit > Insert Variable
• Right-click an existing variable name and click Insert Variable, or
• Click the Insert Variable icon

Research Methodology – Ch. 8 Basics of SPSS 20


Overview
• SPSS environment
• Data view window
• Data creation in SPSS
• Importing Data into SPSS
• Variable in SPSS
• Working with data
• Analyzing data

Research Methodology – Ch. 8 Basics of SPSS 21


Importing Data into SPSS
• For data with SPSS file format (file extension “.sav”)
• Simply open the file in SPSS
• Data stored in other types of files (e.g., Excel spreadsheet,
a text file, …) instruct SPSS how to read the file and then
save it in the SPSS file format (“.sav”)

Research Methodology – Ch. 8 Basics of SPSS 22


Importing Data from an Excel File
• First make sure your Excel spreadsheet is formatted
according to these criteria
• Single row of variable names across the top of the spreadsheet in
the first row
• Variable names should include ordinary letters, numbers, and
underscores (e.g., Gender, Grad_Date, Test_1) and not include
special characters (e.g., "Graduation Date" would not be a valid
variable name because it contains a space)
• The data should begin in the first column, second row (beneath the
variable names row) of the spreadsheet
• Anything that is not part of the data itself (e.g., extra text, labels,
graphs, Pivot Tables) should be removed
• Missing values for string or numeric variables have blank (empty)
cells, or an appropriate predetermined missing value code (such
as -999)

Research Methodology – Ch. 8 Basics of SPSS 23


Importing Data from an Excel File …
• Example of a properly formatted data in Excel 2010

Research Methodology – Ch. 8 Basics of SPSS 24


Importing Data from an Excel File …
• Click File > Open > Data
• The Open Data window will appear
• Follow the steps afterwards

Research Methodology – Ch. 8 Basics of SPSS 25


Importing Data from a Text File
• Data stored in text files have extensions such
as *.txt, *.dat, or *.csv
• Files with extension *.csv are called comma-delimited files
• In this type of file, the observations are separated (or delimited) by
a comma
• Files with the extension *.txt are called text files, and
typically contain tab-delimited data
• Each observation is separated by a tab (created using Tab on the
keyboard)
• Note that it's not mandatory that *.txt files use tabs as delimiters

Research Methodology – Ch. 8 Basics of SPSS 26


Importing Data from a Text File …
• To open text data in
SPSS
• File > Read Text Data
• Follow the steps
afterwards

Research Methodology – Ch. 8 Basics of SPSS 27


Saving Imported Data in SPSS Format
• To save the data as an SPSS data file (*.sav format) by
following these steps
• In the active data window, click
• File > Save As. The Save Data As window will appear
• Choose the directory where you want the file to be saved
• Type a name for your file in the File name field
• When you are finished, click Save

Research Methodology – Ch. 8 Basics of SPSS 28


Overview
• SPSS environment
• Data view window
• Data creation in SPSS
• Importing Data into SPSS
• Variable in SPSS
• Working with data
• Analyzing data

Research Methodology – Ch. 8 Basics of SPSS 29


Defining Variables in the Variable View
• NAME
• The name of the variable refers to that variable in syntax
• Variable names can not contain spaces
• Changing the name of a variable does not change the data
• To change a variable's name, double-click on the name of the
variable that you wish to re-name and type your new variable name

Research Methodology – Ch. 8 Basics of SPSS 30


Variable Types
• For data analysis to be
accurate,
type and formatting of each
variable should be correctly
identify
• Numeric variables have values
that are numbers (in standard
format or scientific notation)
• Missing numeric variables
appear as a period (i.e., “.”).
• String variables have values
that are treated as text
• Also called alphanumeric
variables or character variables

Research Methodology – Ch. 8 Basics of SPSS 31


Variable Types …
• COMMA
• Numeric variables that include commas that delimit every three
places (to the left of the decimals) and use a period to delimit
decimals
• Example: Thirty-thousand and one half: 30,000.50
• DOT
• Numeric variables that include periods that delimit every three
places and use a comma to delimit decimals
• Example: Thirty-thousand and one half: 30.000,50
• SCIENTIFIC NOTATION
• Numeric variables whose values are displayed with an E and
power-of-ten exponent
• Example: 1.23E2, 1.23D2, 1.23E+2, 1.23+2.

Research Methodology – Ch. 8 Basics of SPSS 32


Variable Types …
• DATE
• Numeric variables that are displayed in any standard calendar date
• Example: Dates: 01/31/2013, 31.01.2013
• DOLLAR
• Numeric variables that contain a dollar sign (i.e., $) before numbers
• Example: Thirty-three thousand dollars and thirty-three cents:
$33,000.33
• CUSTOM CURRENCY
• Numeric variables that are displayed in a custom currency format
• You must define the custom currency in the Variable Type window
• RESTRICTED NUMBER
• Numeric variables whose values are restricted to non-negative
integers (in standard format or scientific notation
• Example: 00000123456 (width 11)
Research Methodology – Ch. 8 Basics of SPSS 33
Defining Variables in the Variable View …
• WIDTH
• The number of digits displayed for numerical values or the length
of a string variable
• To set a variable's width, click inside the cell corresponding to
the “Width” column for that variable
• Then click the "up" or "down" arrow icons to increase or
decrease the number width
• DECIMALS
• The number of digits to
display after a decimal point
for values of that variable

Research Methodology – Ch. 8 Basics of SPSS 34


Defining Variables in the Variable View …
• LABEL
• A brief but descriptive definition or display name for the variable
• When defined, a variable's label will appear in the output in place
of its name
• Example: The variable expgradate might be described by the label
“Expected date of college graduation".
• VALUES
• Value labels are useful
primarily for categorical (i.e.,
nominal or ordinal)
variables, especially if they
have been recorded as
codes (e.g., 1, 2, 3)
• Labels help understand what
each value represents

Research Methodology – Ch. 8 Basics of SPSS 35


Defining Variables in the Variable View …
• MISSING
• User-defined values that indicate data are missing for a variable
• Note that this does not affect or eliminate SPSS's default missing
value code (".")
• This column merely allows the user to specify alternative codes for
missing values.
• COLUMNS
• The width of each column in the Data View spreadsheet
• ALIGN
• The alignment of content in the cells of the SPSS Data View
spreadsheet
• Options include left-justified, right-justified, or center-justified

Research Methodology – Ch. 8 Basics of SPSS 36


Defining Variables in the Variable View …
• MEASURE
• The level of measurement for the variable (e.g., nominal, ordinal,
or scale)
• By default, variables with numeric responses are automatically
detected as “Scale” variables
• If the numeric responses actually represent categories, you must
change the specified measurement level to the appropriate setting

Research Methodology – Ch. 8 Basics of SPSS 37


Defining Variables in the Variable View …
• ROLE
• The role that a variable will play in your analyses (i.e., independent
variable, dependent variable, both independent and dependent)
• Input: The variable will be used as a predictor (independent
variable)
• Target: The variable will be used as an outcome (dependent
variable)
• Both: The variable will be used as both a predictor and an outcome
(independent and dependent variable)
• None: The variable has no role assignment
• Partition: The variable will partition the data into separate samples

Research Methodology – Ch. 8 Basics of SPSS 38


Defining Variables with Define Variable Properties
• The Define Variable Properties window is an efficient way
of defining many variables at once, or defining many
variables that share the same formatting
• Click Data > Define Variable Properties

Research Methodology – Ch. 8 Basics of SPSS 39


Codebooks
• A codebook is a document containing information about
each of the variables in your dataset, such as:
• Name assigned to the variable
• What the variable represents (i.e., its label)
• How the variable was measured (e.g. nominal, ordinal, scale)
• How the variable was actually recorded in the raw data (i.e.
numeric, string; how many characters wide it is; how many decimal
places it has)
• For scale variables: The variable's units of measurement
• For categorical variables: If coded numerically, the numeric codes
and what they represent
• USING THE MENUS
• Open the SPSS datafile
• Click File > Display Data File Information > Working File
• The codebook will print to the Output Viewer window
Research Methodology – Ch. 8 Basics of SPSS 40
Overview
• SPSS environment
• Data view window
• Data creation in SPSS
• Importing Data into SPSS
• Variable in SPSS
• Working with data
• Analyzing data

Research Methodology – Ch. 8 Basics of SPSS 41


Working with Data
• Data is organized with Variables
• There are two categories of Data
• Qualitative Data
• Quantitative Data
• Qualitative data are non numerical data and the values
taken are usually names
• nominal data (e.g. Variable EyeColor: black,green, gray, blue …)
• binary or dichotomous (e.g. alive/dead or male/female)
• Tests that can be done
• the Chi2 test
• the null hypothesis
• …

Research Methodology – Ch. 8 Basics of SPSS 42


Working with Data …
• Quantitative data are numerical data that usually measure
values
• Eg. Age, distance, mass, …
• Parametric and Non-parametric tests can be done on
Quantitative data
• In order to apply parametric statistical tests on quantitative
data the following 4 assumptions must be satisfied
• Normally Distributed
• Homogeneity of Variance
• Interval data
• Independence

Research Methodology – Ch. 8 Basics of SPSS 43


Analyzing Data
• Histogram

Research Methodology – Ch. 8 Basics of SPSS 44


Analyzing Data
• Error Bars

Research Methodology – Ch. 8 Basics of SPSS 45


END OF SLIDE

Sem. II, 2010/11 Research Methodology – Ch. 8 Basics of SPSS 46

You might also like