You are on page 1of 11

INTRODUCTION TO SPSS FOR WINDOWS Version 15.

Summer 2007

Contents

Purpose of handout & Compatibility between different versions of SPSS.. 1 SPSS window & menus 1 Getting data into SPSS & Editing data.. 3 Reading an SPSS viewer/output (.spo) file & Editing your pout. 7 Saving data as an SPSS data (.sav) file..... 8 Saving your output (statistical results and graphs) 9 Exporting SPSS Output. 10 Printing your work & Exiting SPSS.. 12 Running SPSS using syntax or command language (.sps files). 13 Creating a new variable. 14 Recoding or combining categories of a variable15 Summarizing your data Frequency tables (& bar charts) for categorical variables. 20 Contingency tables for categorical variables. 21 Descriptive statistics (& histograms) for numerical variables.. 22 Descriptive statistics (& boxplots) by groups for numerical variables. 24 Using the Split File option for summaries by groups 26 Using the Select Cases option for summaries for a subgroup of subjects/observations 27 Graphing your data Bar chart 28 Histogram & Boxplot 29 Normal probability plot. 30 Error bar plot..31 Scatter plot. 32 Adding a line or loess smooth to a scatter plot.. 32 Stem-and-leaf plot..33 Hypothesis tests & Confidence intervals One sample t test & Confidence interval for a mean. 34 Paired t test & Confidence interval for the difference between means. 37 Two sample t test & Confidence interval for the difference between means 39 Sign test and Wilcoxon signed rank test....... 42 Mann Whitney U test (or Wilcoxon rank sum test).............. 45 One-way ANOVA (Analysis of variance) & Post-hoc tests......... 47 Kruskal-Wallis test.....50 One-sample binomial test...... 52 McNemars test..53 Chi-square test for contingency tables...55 Fishers exact test.......55 Trend test for contingency tables/ordinal variables....... 55 Binomial, McNemars, Chi-square and Fishers exact tests using summary data.... 59 Confidence interval for a proportion. 63 Correlation & Regression Pearson and spearman rank correlation coefficient....... 65 Linear regression........68 Liner regression via ANOVA commands..76 Logistic regression 80

Purpose of handout
SPSS for Windows provides a powerful statistical and data management system in a graphical environment. The user interfaces make statistical analysis more accessible for casual users and more convenient for experienced users. Most tasks can be accomplished simply by pointing and clicking the mouse. The objective of this handout is to get you oriented with SPSS for Windows. It teaches you how to enter and save data in SPSS, how to edit and transform data, how to explore your data by producing graphics and summary descriptives, and how to use pointing and clicking to run statistical procedures. It is also intended to serve as a reference guide for SPSS procedures that you will need to know to do your homework assignments.

Compatibility between different versions of SPSS


SPSS for Windows data files (files ending in .sav) and syntax (command) files (files ending in .sps) are compatible between different versions of SPSS (at least, versions 11.0 or newer). However, SPSS output/viewer files (files ending .spo) are NOT always compatible between different versions. Usually SPSS output files created with an old version and can be read by a new version, but an output file created using a new version can not be read by an old version. One option for avoiding compatibility problems between different versions of SPSS is to export your output in html or MS Word format. The compatibility between Window and Mac versions of SPSS is limited.

SPSS Windows & Menus


An overview of the SPSS windows, menus, toolbars, and dialog boxes is given in the SPSS Tutorials under Help. You can also find information under Topics, Case Studies, Statistics Coach, and Command & Syntax (if you are using syntax commands.)

Window Types
SPSS Data Editor. When you start an SPSS session, you usually see the Data Editor window (otherwise you will see a Viewer window). The Data Editor displays the contents of the working data file. There a two views in the data editor window: 1) Data View displays the data in a spreadsheet format with variable names listed for column headings, and 2) Variable View which displays information about the variables in your data set. In the Data View you can edit or enter data, and in the Variable View you can change the format of a variable, add format and variable labels, etc. SPSS Viewer/Output. Statistical results and graphs are displayed in the Viewer window. The (output) Viewer window is divided into two panes. The right-hand pane contains the all the output and the left-hand pane contains a tree-structure of the results. You can use the left-hand pane for navigating through, editing and printing your results.

2 Chart Editor. The chart editor is used to edit graphs. When you double-click on figure or graph, it will reappear in a chart editor window. SPSS Syntax Editor. The Syntax Editor is used to create SPSS command syntax for using the SPSS production facility. Usually you will be using the point and click facilities of SPSS, and hence, you will not need to use the Syntax Editor. More information about the Syntax Editor and using the SPSS syntax is given in the SPSS Help Tutorials under Working with Syntax. A few instructions to get you started are given later in the handout in the section Running SPSS using the Syntax Editor (or Command Language)

Menus
Data Editor Menu: File. Use the File menu to create a new SPSS file, open an existing file, or read in spreadsheet or database files created by other software programs (e.g., Excel). Edit. Use the Edit menu to modify or copy data and output files. View. Choose which buttons are available in the window or how the window should look. Data. Use the Data menu to make changes to SPSS data files, such as merging files, transposing variables, or creating subsets of cases for subset analysis. Transform. Use the Transform menu to make changes to selected variables in the data file (e.g., to recode a variable) and to compute new variables based on existing variables. Analyze. Use the Analyze menu to select the various statistical procedures you want to use, such as descriptive statistics, cross-tabulation, hypothesis testing and regression analysis. Graphs. Use the Graphs menu to display the data using bar charts, histograms, scatterplots, boxplots, or other graphical displays . All graphs can be customized with the Chart Editor. Utilities. Use the Utilities menu to view variable labels for each variable. Add-ons. Information about other SPSS software. Window. Choose which window you want to view. Help. Index of help topics, tutorials, SPSS home page, Statistics coach, and version of SPSS. Viewer Menu: Menu is similar to Data Editor menu, but has two additional options: Insert. Use the insert menu to edit your output Format. Use the format menu to change the format of your output. Chart Editor Menu: Use SPSS Help to learn more about the Chart Editor.

Toolbars
Most Windows applications provide buttons arranged along the top of a window that act as shortcuts to executing various functions. In SPSS, you will find such buttons (icons) at the top the of the Data Editor, Viewer, Chart Editor, and Syntax windows. The icons are usually symbolic representations of the procedure they execute when pushed, unfortunately their meanings are not intuitively obvious until one has already used them. Hence, the best way to learn these buttons is to use them and note what happens. The Status Bar The Status Bar runs along the bottom of a window and alerts the user to the status of the system. Typical messages one will see are SPSS Processor is ready, Running procedure. The Status Bar will also provide up-to-date information concerning special manipulations of the data file like whether only certain cases are being used in an analysis or if the data has been weighted according to the value of some variable.

File Types
Data Files. A file with an extension of .sav is assumed to be a data file in SPSS for Windows format. A file with an extension of .por is a portable SPSS data file. The contents of a data file are displayed in the Data Editor window. Viewer (Output) Files. A file with an extension of .spo is assumed to be a Viewer file containing statistical results and graphs. Syntax (Command) Files. A file witn an extension of .sps is assumed to be a Syntax file containing spss syntax and commands.

Getting Data into SPSS & Editing Data


When reading and editing data into SPSS the data will be displayed in the Data Editor Window. An overview of the basic structure of an SPSS data file is given in the SPSS Help Tutorials: 1. Choose Help on the menu bar 2. Choose Tutorial 3. Choose Reading Data

Reading Data from a SPSS Data (.sav) File


To read a data file from your computer/floppy disk/flash drive that was created and saved using SPSS. The filename should end with the suffix .sav. 1. Choose Open an existing data source 2. Double click on the filename or 3. Single click on the filename and choose OK Or

1. 2. 3. 4. 5. 6. 7.

Choose Cancel Choose File on the menu bar Choose Open Choose Data... Edit the directory or disk drive to indicate where the data is located. Double click on the filename or Single click on the filename and choose Open

Reading Data from an Text Data File


To read an raw/text (ascii) data file from your computer/floppy disk/flash drive, where the data for each observation is on a separate line and a space is used to separate variables on the same line (i.e., the file format is freefield). The filename should end with the suffix .dat. 1. 2. 3. 4. 5. 6. 7. Choose File on the menu bar Choose Read Text Data Choose Files of Type *.dat Edit the directory or disk drive to indicate where the data is located Double click on the filename or Single click on the filename and choose Open Follow the Import Wizard Instructions.

You can also get to the Import Wizard as follows: 1. 2. 3. 4. 5. 6. 7. 8. Choose File on the menu bar Choose Open Choose Data... Choose Files of Type *.dat Edit the directory or disk drive to indicate where the data is located Double click on the filename or Single click on the filename and choose Open Follow the Import Wizard Instructions.

Instructions on how to read a text data file in fixed format are located in SPSS Help Tutorials under Reading Data from a Text File.

Reading Data from Other Types of External Files


SPSS allows you to read a variety of other types of external files, such as Excel spreadsheet files, SAS data files, Lotus 1-2-3 spreadsheet files, and dBASE database files. To read data from other types of external files, you follow the same steps as you would for reading an SPSS save file, except that you specify the file type according to what package was used to create the save file. For further instruction on how to read data from other types of external files, see the SPSS for Windows Base System User's Guide on data files or the SPSS Help Tutorials.

Entering and Editing Data Using the Data Editor


The Data Editor provides a convenient spreadsheet-like facility for entering, editing, and displaying the contents of your data file. A Data Editor window opens automatically when you start an SPSS session. Instruction on Using the Data Editor to enter data is given in the SPSS Help Tutorials. Note that if you are already familiar with entering data into a different spreadsheet program (e.g., MS Excel), you might find it easy to enter your data in the program your are familiar with and then read the data into SPSS. Entering Data. Basic data entry in the Data Editor is simple: Step 1. Create a new (empty) Data Editor window. At the start of an SPSS session a new (empty) Data Editor window opens automatically. During an SPSS session you can create a new Data Editor window by 1. Choose File 2. Choose New 3. Choose Data Step 2. Move the cursor to the first empty column. Step 3. Type a value into the cell. As you type, the value appears in the cell editor at the top of the Data Editor window. Each time you press the Enter key, the value is entered in the cell and you move down to the next row. By entering data in a column, you automatically create a variable and SPSS gives it the default variable name var00001. Step 4. Choose the first cell in the next column. You can use the mouse to click on the cell or use the arrow keys on the keyboard to move to the cell. By default, SPSS names the data in the second column var00002. Step 5. Repeat step 4 until you have entered all the data. If you entered an incorrect value(s) you will need to edit your data. See the following section on Editing Data.

6 Editing Data. With the Data Editor, you can modify a data file in many ways. For example you can change values or cut, copy, and paste values, or add and delete cases. To Change a Data Value: 1. Click on a data cell. The cell value is displayed in the cell editor. 2. Type the new value. It replaces the old value in the cell editor. 3. Press then Enter key. The new value appears in the data cell. To Cut, Copy, and Paste Data Values 1. Select (highlight) the cell value(s) you want to cut or copy. 2. Pull down the Edit box on the main menu bar. 3. Choose Cut. The selected cell values will be copied, then deleted. Or 4. Choose Copy. The selected cell values will be copied, but not deleted. 5. Select the target cell(s) (where you want to put the cut or copy values). 6. Pull down the Edit box on the main menu bar. 7. Choose Paste. The cut or copy values will be ``pasted'' in the target cells. To Delete a Case (i.e., a Row of Data) 1. Click on the case number on the left side of the row. The whole row will be highlighted. 2. Pull down the Edit box on the main menu bar. 3. Choose Clear. To Add a Case (i.e., a Row of Data) 1. Select any cell in the case from the row below where you want to insert the new case. 2. Pull down the Data box on the main menu bar. 3. Choose Insert. Defining Variables. The default name for new variables is the prefix var and a sequential fivedigit number (e.g., var00001, var00002, var00003). To change the name, format and other attributes of a variable. 1. Double click on the variable name at the top of a column or, 2. Click on the Variable View tab at the bottom of Data Editor Window. 3. Edit the variable name under column labeled Name. The variable name must be eight characters or less in length. You can also specify the number of decimal places (under Decimals), assign a descriptive name (under Label), define missing values (under Missing), define the type of variable (under Measure; e.g., scale, ordinal, nominal), and define the values for nominal variables (under Values). After the data is entered (or several times during data entering), you will want to save it as an SPSS save file. See the section on Saving Data As An SPSS Save File.

Reading an SPSS Viewer/Output (.spo) File


Statistical results and graphs are displayed in the Viewer window. An overview of how to use the Viewer is given in the SPSS Help Tutorials under Working with Output. If you saved the results of Viewer window during an earlier SPSS session, you can use the following commands to display the Viewer (output) results in a current SPSS session. However, SPSS output/viewer files (files ending .spo) are NOT always compatible between different versions. Usually SPSS output files created with an older version and can be read by a new version, but an output file created using a new version can not be read by an older version. One option for avoiding compatibility problems between different versions of SPSS is to export your output in html or MS Word format. The compatibility between Window and Mac versions of SPSS is limited. To read a Viewer file from your computer\floppy disk\flashdrive that was created and saved using SPSS. The filename should end with the suffix spo. 1. 2. 3. 4. 5. 6. Choose File on the menu bar Choose Open Choose Output... Edit the directory or disk drive to indicate where the data is located Double click on the filename or Single click on the filename and choose Open

Editing Your Output


Editing the statistical results and graphs in the Viewer window is beyond the scope of this handout. Instructions on how to edit your output is given in the SPSS Help Tutorials under Working with Output and Creating and Editing Charts. You can use either the tree-structure in the left hand pane or the results displayed in the right hand pane to select, move or delete parts of the output. To edit a table or object (an object is a group of results) you first need to double click on the table/object so an editing box appears around the table/object, and then select the value you want to modify. An editing box' will be a ragged box outlining the table. If you only do a single click you will get a box with straight/plain lines outlining the table. In general, to create nice looking tables of your results it is often easier to hand enter the values into a blank MS Word table than to edit a SPSS table/object (either in SPSS or MS Word). To edit a chart you first need to double click on the chart so it appears in a new Chart Editor window. After you are done editing the chart, close the window and then export the chart, for example to a windows metafile and then into a MS Word file.

8 By default in SPSS a P-value is displayed as .000 if the P-value is less than .001. You can report the P-value as <.001 or to have SPSS display more significant digits: 1. In a SPSS (output) Viewer window double click (with the left mouse button) on the table containing the p-value you want to display differently A ``editing box'' should appear around the table. 2. Click on the p-value using the right mouse button. 3. Choose Cell Properties. (If you do not get this option, you need to double click on the table to get the ragged box.) 4. Change the number of decimals to the desired number (default is 3). 5. Choose OK or 6. Double click on the p-value with the left mouse button and SPSS will display the p-value with more significant digits. If the p-value is very small, the p-value will be displayed in scientific notation (e.g., 1.745E-10 = 0.0000000001745).

Saving Data as an SPSS Data (.sav) File


To save data as a new SPSS Data file onto your computer/floppy disk/flashdrive: 1. Display the Data Editor window (i.e., execute the following commands while in the Data Editor window displaying the data you want to save.) 2. Choose File on the menu bar. 3. Choose Save As... 4. Edit the directory or disk drive to indicate where the data should be saved. SPSS will automatically add the .sav suffix to the filename. 5. Choose Save To save data changes in an existing SPSS Save: file. 1. Display the Data Editor window (i.e., execute the following commands while in the Data Editor window displaying the data you want to save.) 2. Choose File box on the menu bar 3. Choose Save Caution. The Save command saves the modified data by overwriting the previous version of the file. You can save your data in other formats besides an SPSS save file (e.g., as an ASCII file, Excel file, SAS data set). To save your data with a given format you follow the same steps as saving data in a new SPSS Save file, except that you specify the Save as Type as the desired format.

You might also like