**SPSS: Basics**

Dave Luckenbaugh

NIMH: Mood & Anxiety Disorders Program

\(301\) 594-1372

[luckenbd@mail.nih.gov](mailto:luckenbd@intra.nimh.nih.gov)

**[File]{.underline}**

Open

• Excel

• Read variable names from first row of data

• Select if the first row in the spreadsheet is the variable names.

• Worksheet

• Choose the worksheet you want if there are multiple sheets.

> • Only one worksheet can be chosen at a time. Use Open Database to
> combine worksheets in one step.

• Range

• Allows importing of a subset of the worksheet.

Open Database

• Allows you to create, edit, and run database queries from a variety of
databases.

• Facilitates combining multiple worksheets from Excel into one file.

Read Text Data

• Enables you to open files with a text format, such as tab delimited
files.

**[Edit]{.underline}**

Options

• General

• Variable Lists

> • Choose what to call variables and how to order them in all of the
> menus in the software.
>
> • Consider: Display Names, Alphabetical

• Session Journal

> • Records all syntax used while working in SPSS, so you can go back
> and figure out how you did something if you cannot recall.

• Choose Append

• Output Labels

• Choose what to call variables in output.

• Consider: Labels in each

• Charts

• Chart Template

• Can specify specific design for all charts.

• Interactive

• Chart Look

• Specify specific design for interactive graphics.

• Data Saved with Chart

• Can include data with saved chart to allow later editing.

• Pivot Tables

• Specify specific design for tables.

• Consider: Academic (VGA narrow).tlo

• Scripts

• Formatting imposed on various output.

• Check Enable Autoscripting.

**[Data]{.underline}**

Define Variable Properties

> • Specify properties of individual variables.
>
> • Allows copying of properties from other variables within the open
> dataset.

Copy Data Properties

> • Take variable properties from files or variables and apply them to
> other files or variables.

Sort Cases

• Right click on variable name and choose this option or use the Data
menu.

• This will sort the entire dataset, not just a single variable.

Restructure

• Variables into Cases

> • Re-organize dataset so certain variables (columns) are made into
> separate cases (rows).
>
> • [Example]{.underline}. A separate column for the depression ratings
> at each week observed where each person is in a single row is changed
> into a single column for all depression ratings where each person has
> a row for each week observed.
>
> • The outcome is appropriate for linear mixed models.

![](media/image1.png){width="3.0in" height="1.3333333333333333in"}

• Cases into Variables

> • Re-organize dataset so certain cases (rows) are made into separate
> variables (columns).
>
> • Identifier variables show what should be used to make separate rows.
> These are often subject or id variables.
>
> • Index variables show how columns should be separated. They are
> frequently variables for the time or condition under study.
>
> • [Example]{.underline}. A single column for all depression ratings
> where each person has a row for each week observed is changed into a
> separate column for the depression ratings at each week observed where
> each person is in a single row.
>
> • The outcome is appropriate for repeated measures ANOVA.

![](media/image1.png){width="3.0in" height="1.25in"}

Merge

• Files must be in SPSS format (.sav) before running this command.

• Add Cases

• Use to add new cases to an existing dataset.

• Add Variables

• Use to add new variables to an existing dataset.

• Can add new cases at the same time as adding new variables.

> • Be sure to sort data in both files in the same manner on variables
> to be used to match cases before trying to merge.

Aggregate

• Creates new dataset with summary statistics.

Identify Duplicate Cases

• Assists in finding cases repeated in dataset.

• Excellent when trying to match cases on certain variables.

Split File

• Separate analysis into subsections based on a variable or set of
variables.

> • [Example]{.underline}. If you want to run ANOVAs for each gender
> separately, use this to get separate results for each gender using the
> same model.

Select Cases

> • Allows you to ignore certain observations (Filter) or delete them
> based on some criteria.

• Use the "If" button for most cases.

Weight Cases

> • Based on a given criteria, give some data more prominence than
> others.
>
> • Useful for computing certain statistics when only summary data is
> available .

**[Transform]{.underline}**

Compute

• Calculate a new variable.

• Calculate only under certain circumstances using the "If" box.

> • [Example]{.underline}. If you want total scores for only a subset of
> a sample.

• Many different transformations can be made with pre-specified
procedures.

• If using syntax, remember to use an EXECUTE command after it.

Recode

> • Re-organize a variable so values that mean one thing initially can
> mean something else.
>
> • [Example]{.underline}. If you have a variable with 10 separate
> diagnoses, you can collapse those down into a smaller number of
> groups.

Visual Bander

> • This is a visually oriented recoding or re-categorizing system.

Count

> • Creates a variable with the number of times a certain value occurs
> within each case.
>
> • A single variable or multiple variables may be used to create the
> count.
>
> • A single value, multiple values, or a range can be specified for
> counting.
>
> • [Example]{.underline}. Make a variable with the number of times an
> individual selects option 3 in a list of questions, or count the
> number of times option 2 or 3 is selected.

Rank Cases

• Create ranks for a variable of interest or for one variable based on
another.

Automatic Recode

• Makes a string variable into a numeric one by assigning dummy codes.

Replace Missing Values

• Substitute values or codes for values that are missing.

**[Analyze]{.underline}**

Reports

• Case Summaries

• Develop formal lists of data or summary values.

Descriptive Statistics

• Frequencies

> • Provides number of cases with given type of data for a single
> variable along with associated graphics.

• Explore

• Examine variable distributions

• Tests for normality with histograms, boxplots, etc.

• Good for preliminary data examination and evaluating test assumptions.

• Crosstabs

• Provides tables for tabulating multiple categorical variables.

> • Includes chi-square test of independence, odds ratio, McNemar test,
> Cochran-Mantel-Haenszel tests, etc.

Compare Means

> • Create tables of means or perform independent t-tests, paired
> t-tests, or oneway ANOVA with contrasts or post hoc tests.

GLM

• Univariate (ANOVA)

> • Allows one or more independent variables with specification for
> fixed or random effects, covariates, partial models, post hoc tests or
> simple effects tests for main effects, etc.

• Simple effects tests for interactions require syntax (See syntax).

• Multivariate (MANOVA)

• Same as univariate with ability to examine multiple dependent
variables.

• Need syntax to specify repeated measures factors.

• Repeated Measures

> • Run ANOVA with repeated measures or within subjects factors with or
> without between subjects factors.
>
> • Use simple effects tests for post hoc analysis of within subjects
> factors.

• Require separate column for data at each time point.

Mixed Models

• Create linear mixed or random regression models.

• Specify variance-covariance structure for repeated measures factors.

> • Estimate missing values with maximum likelihood or restricted
> maximum likelihood methods.

Correlate

• Bivariate

> • Run standard univariate correlations: Pearson's r, Spearman's rho,
> and Kendall's tau.

• Partial

> • Carry out partial correlations, where one or more covariates are
> factored out of relationship between 2 variables.

Regression

• Linear

> • Examine influence of one or more continuous variables on a single
> continuous variable.

• Binary Logistic

> • Examine influence of one or more variables on a single dichotomous
> variable.

• Multinomial Logistic

> • Examine influence of one or more variables on a single categorical
> variable with more than 2 categories.

Data Reduction

• Factor

> • Perform factor analysis with any number of extraction and rotation
> techniques.

Scale

• Reliability Analysis

> • Run various reliability statistics such as Cronbach's alpha and
> Interclass Correlation Coefficients as well as scale construction and
> analysis statistics.

Nonparametric Tests

> • Perform tests which do not require normal distribution assumption,
> such as chi-square, Mann-Whitney U, Kruskal-Wallis, Median test, sign
> test, Wilcoxen ranked sum, McNemar test, Friedman's ANOVA, Cochran's
> Q, etc.

Survival

> • Evaluate the time to a specific event through survival analysis
> techniques such as Kaplan-Meier statistics and Cox Regression.

**[Graphs]{.underline}**

Gallery

> • Pictorial listing of graphics for finding the type of graph you want
> and how to make it. This works like a visual graphics help menu.

Interactive

> • This is the most flexible graphics section of SPSS.
>
> • Variables are moved by dragging and dropping them into place.
>
> • Variables have a specific scale (categorical or continuous) that
> must be correct for use in certain places. Change the scale by right
> clicking on a variable and selecting the scale you want.
>
> • Syntax is available for these graphics, but you may need to use a
> Chart Look to save changes from the original format. Some features may
> not be easily programmable.

Line

• Creates line graph showing course of score over time.

> • Default is to show the number of cases at given time points. Use
> "Other Summary Function" option to use means, sums, or other types of
> information.
>
> • Can specify multiple lines and/or multiple variables to graph
> simultaneously.

Boxplot

> • Center line is the median, top of box is 75^th^ percentile and
> bottom of box is 25^th^ percentile. Lines extending from box go to
> highest point within 1.5 box lengths, other values may be considered
> outliers.

Error Bar

• Makes graphic showing mean with bars indicating a specified confidence
interval.

Scatter

• Creates scatterplot showing pattern of relationship between 2
variables.

• Matrix feature allows look at several variables simultaneously.

> • Can mark individual data points or groups separately and create
> distinct regression lines.

Histogram

• Displays standard histogram with option of including the standard
normal curve.

> • Chart Editor can be used to change width of bars by double clicking
> on the graph, double clicking on the x-axis, and changing the
> specifications on the Histogram Options tab.

**[Help]{.underline}**

Tutorial

> • Particularly if you are just getting started, use the tutorials
> included with the software. They should introduce you to features
> appropriate to the version you have.

Case Studies

> • Description and example of specific statistical techniques, showing
> the basics of what you will get from each procedure and what it means.

Statistics Coach

> • Assistance in finding the right statistic or procedure to use with
> your data. Tells why to find what you need within the software.

Command Syntax Reference

> • Guide to syntax. Once opened, click on "Commands" to get to actual
> syntax and explanation of options.

***[Miscellaneous]{.underline}***

Chart Editor

> • Double click on any graphic in Output Window to open a window for
> editing.
>
> • Once the editor is open, right click on any area of the graphic to
> select or move elements. Double clicking will open up boxes to edit
> features. Many changes can be saved in a template for later use with
> other graphics.

Output

• Notes box

> • Contains name of data file, information about filters and split
> files, as well as syntax for procedures run.

• Exporting to other files

> • This can be done by choosing "Export" on the File menu. There are a
> variety of options for choosing a limited set of information from the
> output window.

Pivot Tables

> • Tables can be manipulated by double clicking and using a variety of
> boxes to manipulate the structure and appearance of the table. The
> Pivot Tables box allows one to change the rows and columns around, for
> instance. Syntax cannot be used for this.
>
> • To create a graphic from the table right click and choose "Create
> Graphic". You will get an editable interactive graphic. Syntax cannot
> be used for this.
>
> • To use a subset of data for the graphic, highlight the data you want
> before right clicking and choosing "Create Graphic". An interactive
> graphic will open for editing.

Results Coach

• In an output file, click on a table then right click and choose
"Results Coach".

> • For many procedures you will get a general description of what is in
> the table and sometimes how to interpret it.

Right click on:

> • Any word in the program
>
> • Provides information about the topic in most places. Some more
> recent additions to the software (Mixed Models, for instance) do not
> include notes.
>
> • Any variable
>
> • Provides information about the variable, such as labels and
> information type.

SPSS Windows and File Types

• Data

• Data View shows data like a spreadsheet.

> • Variable View shows properties of variables, such as existing labels
> and codes.

• Output

• Presents outcome of commands run as well as errors and warnings.

> • Outline on left side facilitates navigation through this window and
> allows opening and closing of elements like a book by double clicking
> on the icon next to the item of interest.

• Syntax

• Holds program for making desired data manipulations and calculations.

Toolbar

• Dialog Recall

> • Shortcut to the last 10 procedures run. If you have not changed or
> closed a data file, the most recent variables remain in the
> appropriate places. Does not work for some of the more complex data
> manipulations like "Restructure".
>
> ![](media/image2.png){width="0.5in" height="0.5833333333333334in"}

• Variables

> • Provides description of variables including any labels or codes.
>
> ![](media/image2.png){width="0.5in" height="0.5833333333333334in"}

• Value Labels

> • Turns labels on and off for values within variables.
>
> ![](media/image2.png){width="0.5833333333333334in"
> height="0.5833333333333334in"}

"Transformations Pending"

> • If you see this note at the bottom of the active SPSS page, the
> system may be processing or you may need to run an EXECUTE command.

Syntax

> • Click on "Paste" for most commands and the code for the procedure
> will be added to a syntax file which can be saved and used later.
>
> • Type "\*" at the beginning of any line in the syntax file and that
> will deactivate any command that follows unless there is a ".". This
> is useful for making notes to yourself or others within the program
> that makes up the syntax file.
>
> • Excellent for re-running the same analysis, checking that you did
> things right, sharing your work, doing things not in the drop down
> menus, and getting help.

\***Calculate Age** from current time and birth date variable: first
version (age1) gives exact age, second version (age2) gives age in whole
numbers rounded down. Substitute a different date than \$time (a system
variable) to get age to a different time point.

COMPUTE age1 = (CTIME.DAYS(\$time - birthdate))/365.25.

COMPUTE age2 = TRUNC((CTIME.DAYS(\$time - birthdate))/365.25).

EXECUTE.

\***Create a new variable based on multiple conditions** (using group
and age variables in this case), or calculate score differently
depending on various criteria. In this example, the group and age
variables are used to create 4 categories of a new variable called
"new".

DO IF group = 1 and age \< 50.

COMPUTE new = 1.

ELSE IF group = 1 and age \>= 50.

COMPUTE new = 2.

ELSE IF group = 2 and age \< 50.

COMPUTE new = 3.

ELSE IF group = 2 and age \>= 50.

COMPUTE new = 4.

ELSE.

COMPUTE new = 999.

END IF.

EXECUTE.

\***Define certain values as missing** based on a code for a given
variable or set of variables. SPSS will treat the values as if nothing
was in the cell. In the example below, any values of 999 for the
variable called "new" will be treated as missing.

MISSING VALUES new (999).

\*Get **simple effects tests** for use in interpreting interactions from
ANOVA. In this case the diagnoses will be compared within each gender.
Bold text shows what you cannot paste from the drop down menu.

UNIANOVA

errors BY diagnosis gender

/METHOD = SSTYPE(3)

/INTERCEPT = INCLUDE

/PLOT = PROFILE(diagnosis \* gender)

/EMMEANS = TABLES(diagnosis) COMPARE ADJ(BONFERRONI)

/EMMEANS = TABLES(gender)

/EMMEANS = TABLES(diagnosis \* gender) **COMPARE(diagnosis)
ADJ(BONFERRONI)**

/PRINT = DESCRIPTIVE ETASQ HOMOGENEITY

/CRITERIA = ALPHA(.05)

/DESIGN = diagnosis gender diagnosis\*gender.

\*Get **nested effects** in ANOVA, MANOVA, or GLM. Here the group effect
is nested within the diagnosis effect. Bold text shows what you cannot
paste from the drop down menu.

UNIANOVA

errors BY diagnosis group

/METHOD = SSTYPE(3)

/INTERCEPT = INCLUDE

/CRITERIA = ALPHA(.05)

/DESIGN = diagnosis **group (diagnosis)**.

***[Resources]{.underline}***

**CIT:**

Statistical Software Team: (301) 594-6248,
[tasc@nih.gov](mailto:TASC@nih.gov),

<http://support.cit.nih.gov/statsoft/index.asp>

Version 13.0 available -- be sure to check the SPSS website for patches
as this is a relatively new release.

Has updated SPSS manuals to download for learning and using the most
recent versions, including a 720 page Base User's Guide, a Brief Guide,
as well as specific manuals for advanced statistics, regression,
creating and using tables, programming and data management, etc.

**NIH Library:**

Lawal, B. (2003). Categorical Data Analysis with SAS and SPSS
Applications. Mahwah,

N.J.: Lawrence Erlbaum Associates. (QA 278.L384)

Norusis, M.J. (1996). SPSS 6.1 Guide to Data Analysis. Englewood Cliffs,
N.J.: Prentice

Hall. (HA32 .N6514)

> Good basic introduction to common data analysis procedures, but
> frequently does not go into great depth. 12.0 version available.

Norusis, M.J. (2003). SPSS 12.0 Statistical Procedures Companion.
Englewood Cliffs, N.J.:

Prentice Hall. (HA32 .N685)

> Practical discussion of how to perform statistics with SPSS with tips
> and warnings to help you get the best information from your data.
>
> Chapter on mixed models is one of the most comprehensible I've seen.

Polit, D.F. (1996). Applications Manual to Accompany Data Analysis &
Statistics for

Nursing Research. Stamford, Conn.: Appleton & Lange. (RT 81.5.P621)

Sa, J.P. Marques de (2003). Applied Statistics: Using SPSS, STATISTICA
and

MATLAB. N.Y.: Springer. (QA 276.4.A575)

Schulman, R.S. (1992). [Statistics in Plain English with Computer
Applications]{.underline}. NY: Van

Nostrand Rheinhold. (QA 276 .S386 1992)

> Good introduction to statistics in "plain English" with chapters on
> factorial designs and multiple regression, as well as discussion of
> SPSS, SAS, and Minitab syntax and output, which is dated.

**Web:**

<http://www.spss.com/>

> SPSS homepage. The support section has the most useful information.
> Includes papers on how to use and interpret procedures and output and
> search mechanism for common questions.
>
> Training classes offered by the company at their sites (closest in
> Arlington, VA) are usually very good, as are the accompanying manuals.
>
> Version 13.0 is now available, but patches go up to version 12.02.

<http://pages.infinit.net/rlevesqu/>

Numerous collection of tips and techniques for using SPSS.

<http://groups-beta.google.com/group/comp.soft-sys.stat.spss?hl=en&lr=&ie=UTF-8>

Collection of responses to questions from SPSS newsgroup.

<http://www.ats.ucla.edu/stat/>

> Extensive collection of resources for learning and using SPSS, SAS,
> and Stata.
>
> SPSS Starter kit includes 90 minute movies and notes from1 classes on
> various SPSS topics from the most basic functions to multivariate
> statistics.

<http://www.ats.ucla.edu/stat/spss/library/spssmixed/mixed.htm>

> Tutorial on linear mixed models in SPSS.

<http://calcnet.mth.cmich.edu/org/spss/toc.htm>

> Large set of information and tutorials, including several minute
> movies, on using SPSS, focused on version 9.

<http://www.utexas.edu/its/rc/tutorials/index.html>

> Tutorials for starting to use SPSS, focused on version 10.

**Other:**

Tabachnick, B.G. & Fidell, L.S. (1989). [Using Multivariate Statistics
(2^nd^ Edition)]{.underline}. NY:

Harper & Row. (QA 278.T3 1989)

> Good start in multivariate statistics with a nice chapter on screening
> data. Illustrates use of statistics with SPSS, SAS, SYSSTAT, and BMD.
> 4th edition available.