Excel files have file extensions of .xls or xlsx, and are very common ways to store and exchange data. To open these files in SPSS, go to File > Open, and select Data from the drop-down menu. Under Files of Type, change it from "SPSS Statistics (*.sav)" to "Excel (*.xls, *xlsx, *.xlsm)," then choose your file in whatever folder it has been saved. Click Open, and you will get one more menu.
Because Excel files can have multiple worksheets within each file, select the worksheet you want, and make sure the box is checked next to "Read variable names from first row of data."
Click OK and your file will load; check to make sure it looks as you expected.
Your data are loaded and ready to analyze.
Sometimes you don't have the data itself, but a frequency table derived from the data. You can enter this by hand using frequency weights. This works when you have one or more categorical variables. Let's start with an example with one categorical variable, for example:
Value | Frequency |
---|---|
Ran | 8 |
Did not run | 18 |
In this example, you have one dichotomous variable (whether a subject ran or did not run in an experiment), and the Frequency column indicates how many cases fell in either of this categories. To enter this as a weighted table, first we need to create a new dataset. Open a new dataset from File > New > Data.
At the bottom of the Data Editor Window, click on Variable View to create new variables. In this example, you'll want two variables: Ran (with values of 1 or 0, for ran or did not run) and Frequency, with values from the frequency column above. Enter the names of the variables in the Name column, leave the type as Numeric, and change the Decimals column to zero, because all the values will be integers. (The Width and Decimals columns shown here control what kind of number can be stored in the variable; Decimals refers to how many places there are to the right of the decimal point, while Width is total number of places.)
Switch back to Data View (bottom of the screen) to enter the data. In the Ran column, enter 0 and 1 on two lines, for ran and did not run, then in the Frequency column enter the corresponding values from the frequency table at the beginning of the example. These values represent how many people ran or did not run in the experiment.
In order to make this work as a frequency table, go to Data > Weight Cases. Choose "Weight Cases By" and move frequency into the frequency variable field, then click OK. Now you can do analyses like binomical test or chi-square goodness of fit.
You can create weighted tables for tests using more than one categorical variable, also. In the example below, we have two categorical variables presented in a contingency table.
Ulcers | Thalidomide | Placebo |
---|---|---|
Ulcers healed | 14 | 1 |
Ulcers did not heal | 9 | 21 |
Open a new dataset from File > New > Data. At the bottom of the screen, click on Variable View to create new variables. In this example, you'll want three variables: thalidomide (0 or 1 for yes or no), healed (0 or 1), and frequency (numeric). Enter these three on three separate lines under Name. Under Type, leave them all as Numeric. You can change any field by clicking on it.
Switch back to Data View (bottom of the screen) to enter the data. The values for thalidomide and healed will be combinations of 1 or 0 (for yes or no), while frequency will contain the numbers corresponding to the table above. There will be four rows.
In order to make this work as a frequency table, go to Data > Weight Cases. Choose "Weight Cases By" and move frequency into the frequency variable field, then click OK.
Now you can use Analyze > Descriptive Statistics > Crosstabs... to analyze these data, for example. These kinds of tables will also work for other non-parametric statistics like the binomial test, but in that case you would have only one dichotomous variable instead of two.
New variables can be created in the Variable View of the Data Editor Window. The Variable View can be toggled with the tab in the lower left hand corner of the Data Editor window.
This window lets you enter information about variables, which can be important for how data work in tests, and how data are displayed. All of the following fields can be changed by clicking in the field and typing in a new selection. Pay attention to the following fields:
Sometimes a categorical variable is stored as a string (or text) variable, but a test requires a numeric variable. The easiest way to fix this is to create a new variable with Automatic Recode that will convert the variable to numeric with labels containing the old string values.
Go to Transform > Automatic Recode.
Move the string variable over into the Variable > New Variable list. In the field next to New Name, enter a variable name different from the original variable, then click Add New Name. (In the case illustrated, the RC in the new variable name indicates a recode.) Then click on OK, and a new variable will be created.
Go to Transform > Compute Variable...
This menu allows you to create new variables based on existing variables. In the Target Variable field in the upper left, type in the name of the variable you want to create. Then, on the right-hand side of the menu, select the transformation you want to perform. Most of what you'll need is in the Arithmetic group, so first click on Arithmetic in the Function Group list, and then select the required transformation from Functions and Special Variables; for example, if you want to take the log of an existing variable, double-click on Lg10.
You will see "LG10(?)" entered into the the Numeric Expression box. To replace that question mark with the variable you need to the log of, select the appropriate variable from the list on the left and click on the arrow to move it into the expression. When the expression is complete, click on OK and your new variable will be created.
Other transformations can be computed in the same way; select Ln for natural log, Arsin for arcsine, or Sqrt for the square root. Exp will give you e raised to the power of whatever number or variable you enter.
The Explore menu can create histograms and Q-Q plots for assessing whether your data are normally distributed, as well as a number of descriptive statistics. Go to Analyze > Descriptive Statistics > Explore to begin.
A frequency table will show you all the values for a particular variable, and the frequency in which they are present. It is appropriate for a categorical variable, whether it is stored as a numeric-type or string-type. To create the table, go to Analyze > Descriptive Statistics > Frequencies... In the Frequencies menu, move the desired variable into the Variable(s) list, then click OK.
To create a boxplot, you will need a continuous numeric variable; it is typically used also with a categorical variable that divides your data into groups. It is also available through the Explore menu. Go to Analyze > Descriptive Statistics > Explore to begin.
You can get summary statistics for variables by going to Analyze > Descriptive Statistics > Descriptives, and selecting variable. If, however, you would like summary statistics according to group membership, first you will need to click on Data > Split File. There, you can move the variable that identifies which group an observation belongs to by clicking on the button next to "Compare groups," then moving that grouping variable into the Groups Based On list. For example, if you want summary statistics according to gender, move a variable identifying gender into Groups Based On. Click OK, then proceed with Analyze > Descriptive Statistics > Descriptives, and your summary statistics will appear in the output according to your groups.
Note that the file will remain split until you turn it off, by going back to Data > Split File and clicking on "Analyze all cases, do not create groups."