# Survey research and design in psychology/Tutorials/Introduction/SPSS
## Aim

The aim of this tutorial session is to (re)-familiarise participants with the SPSS software environment and to highlight some of its features which will be particularly useful during this unit.

## Demo data file

* View the accompanying screencast:
The Microsoft Excel file (World95.xls) contains demographic data about people in 109 countries around the world in 1995:
* Data file: World95.xlsx
* Save the file onto the desktop or a local drive/folder
* Open SPSS, then open the World95.xls data file:
** Change the Files of type: to Excel (.xls, .xlsx, .xlsm)
** Accept the default prompt about whether to 'read the variable names - yes, they are in the first row
* Once imported, the data file can be saved as a SPSS data file (File - Save As - World95.sav)
Learning outcome: Participants should understand that SPSS can be used to open many different data file formats, Excel being a common example.

## Windows / file types

There are three main types of files in SPSS. Important features of these files are:
| Data (.sav) | Output (.spv) | Syntax (.sps) |
| Data view Variable view Inserting/deleting cases and variables Sorting | Navigation bar Chart editing Table editing | Pasting Executing Notating Saving Copying and editing |
Learning outcome: Students should appreciate and understand that there are three files types in SPSS, each with their own purpose and functionality. To optimise use of SPSS, students should become familiar with viewing and editing each of the three file types.

## Working with data

* View the accompanying screencast:
There are several data file manipulations that are commonly used and needed:
* Insert and Delete:
** Variables
** Cases
** Data
* Sort by a variable
** Ascending
** Descending
** Sorting by more than one variable
* Recode a variable to create a new variable
** Recode LIFEEXPF (Life Expectancy for Females) (a ratio variable) into LIFEXPFR, an Ordinal variable with
*** 1 (Low) = < 70 years
*** 2 (High) = 70+ years
Learning outcome: Know how to perform basic data variable and case manipulations in SPSS.

## Working with output

* View the accompanying screencast:

### Chart manipulation

Create a chart in SPSS (via Graphs e.g., a histogram of women's life expectancy) and then edit the chart until it is in APA style. Changes should include:
* Use monotone shading
* Remove default background (fill) and box (border)
* Edit the axis labels
* Remove descriptive statistics (legend)
* Graphs can be prepared in SPSS, Excel, MS Word (Insert - Object - Microsoft Graph Chart), or many other packages.
Learning outcome: Additional editing is generally needed to present figures in APA style.

### Table manipulation

Generate a table (e.g., through Descriptive Statistics - Frequencies - LIFEEXPF) and edit to APA style, e.g.,
* Editing can be done in either in SPSS output or by copying into a word processor
* Often its easier to create a new table in a spreadsheet or word processing program
Important aspects of APA style tables:
* Gridlines: Only show horizontal lines above and below the header row and at the bottom of the table
* Meaningful row and column labels
* Correct statistical symbols
* Times New Roman 12pt font
* A title caption above the table
* Convey maximum (relevant) information in the most efficient and understandable way
Learning outcome: Know how to create an APA style tables in a word processing document.

### Copying output to MS Word

* Right click on an SPSS Output Table or Graph
* "Copy"; treats the item as elements (which can be edited after pasting) - best option for Tables
* "Copy objects"; treats the item as a picture (not editable) - it will look as (almost) exactly as it does in the SPSS output - best option for Charts.
* In a MS Word document ctrl-v (to paste) (or choose Edit - Paste)
* Horizontally centre the Figure or Table
* Add an APA style Figure caption below the chart.
Learning outcome: Know how to copy an SPSS chart into a word-processing document and present in APA style, with a caption.

## Working with syntax

Syntax is a powerful way of conducting SPSS data analysis:
* SPSS syntax files are text files which allows you to store, modify, and then re-run specific commands.
* Storing syntax is particularly useful when working over multiple sessions on a series of related analyses, particularly if you need to re-run the results.
* To open the SPSS syntax editor, File → New → Syntax. The SPSS syntax editor is an enhanced text editor.
* There are two ways to generate syntax:
** Use the pull-down menus to build analyses and then click "Paste". This will dump the command syntax into a (.sps) file. The syntax file can then be saved. To run the command, put the cursor on the command somewhere (or highlight it) and click on the green "Run" (play) button.
** Type SPSS commands directly into the syntax screen. This takes a lot to learn, but you can also copy and modify syntax.
* Annotate syntax files with lines which start an asterisk (*) and finish with a full-stop (.). That way you will be more easily be able to come back to the syntax file later on. e.g., * THIS IS A SPSS COMMENT - it starts with an asterisk and finishes with a full-stop.
* SPSS tutorial exercises will generally demonstrate use of syntax.
* See also
** SPSS → Help → Tutorial → Working with Syntax
** Using syntax
** Guides to working with syntax in SPSS lab manuals
Learning outcome: Understand the purpose and function of syntax commands in SPSS and have observed and experienced creating, executing, notating and saving syntax.

## Help

To get help with SPSS, try the Help menu, particularly:
* Topics
* Tutorials
* SPSS Australia
Learning outcome: Students should become familiar with the help features available within SPSS.