Learn How To: 1. Enter Data: Basics of SPSS
Learn How To: 1. Enter Data: Basics of SPSS
Learn how to: 1. Enter data Start SPSS Type in data Define variables & identify variable names Save a data file Open an existing data file 2. Edit Data Insert & delete variables and cases/rows Edit & sort data Print data 3. Manipulate data Select cases and filter data Transform & recode data
Basics of SPSS
Start SPSS When you first open SPSS, you will be presented with the opening window. This window allows you to select from several options concerning how you would like to begin your session. If you do not want to start from this window in the future, select the box next to Dont show this dialog in the future. The most likely options you will select are to type in data and to open an existing data source.
Walk through the tutorial designed by SPSS. It includes starting SPSS, entering and manipulating data and running basic statistics.
Entering Data
Open the data view consisting of a blank spreadsheet into which you can enter raw data by hand.
Open data that has already been saved. This data is likely to be saved from a prior use in which you typed in your own data. Later tutorials will discuss how to open data files other than SPSS data files (i.e. Excel files or database files). Check this button, and then select the file to open in the window below. If the preferred file is not shown, select more files and identify the data file to open.
From: http://www.usd.edu/~aschwein/Stats/Tutorials/SPSS%20Tutorial.pdf
Basics of SPSS 2 of 13
Type in Data
When SPSS is opened, a blank spreadsheet will appear:
Type one data point per cell. Each column represents one variable o Ex: gender, test score, etc. Keep one subject per row. o Ex: row 1 represents the first subject; row 2 represents the second subject, etc. Data may include numbers or letter strings.
Practice entering data: Assume a test was given to 6 people. Data recorded: o Gender o Age o Test score Each person also received an ID number The data are as follows:
Subject 1 2 3 4 5 6 Gender m f m f f m Age 18 21 20 19 18 22 Test Score 95 80 75 79 88 62
From: http://www.usd.edu/~aschwein/Stats/Tutorials/SPSS%20Tutorial.pdf
Basics of SPSS 3 of 13
1. Select the top left cell and enter a 1. SPSS defaults to 2 decimal points. This can be changed and will be discussed later. 2. Use the tab key to move across the row and enter an m. You could also use the arrow keys to change cells. 3. M and F may not appear and instead SPSS places periods. This is because SPSS is expecting numerical values to correct this. Option 1: recode gender to numerical values, such as a 1 for males and a 2 for females. Option 2: edit the variable characteristics in Variable View (discussed later). 4. SPSS automatically names the variables (ex: VAR00001). This can be changed and will be discussed later. The data should look like this:
From: http://www.usd.edu/~aschwein/Stats/Tutorials/SPSS%20Tutorial.pdf
Basics of SPSS 4 of 13
Defining Variables and Variable Names Use Variable View to define the variables. Variable view is located in the bottom left corner of the page. Data View was used to type in the data. Variable View allows further definition of the variables.
Each row represents a different variable. There are 4 variables subject ID, gender, age, and test score that SPSS named as VAR00001 through VAR00004.
From: http://www.usd.edu/~aschwein/Stats/Tutorials/SPSS%20Tutorial.pdf
Basics of SPSS 5 of 13
Practice using Variable View: 1. Name Type the variable name to describe the data in that column. VAR00001 = ID, VAR00002 = gender, VAR00003 = age, VAR00004 = score FYI about variable names o Must be less than 64 characters long o Begin with a letter o Not end with a period or contain spaces o These characters are allowed: $ # _ @ o These characters are not allowed: * ! ?. o Reserved words are not allowed that correspond with SPSS functions: ALL, AND, BY, EQ, GE, GT, LE, LT, NE, NOT, OR, TO, WITH 2. Type Select the type of variable: numeric, comma, dot, scientific notation, date, dollar, custom currency, or string. (String represents letter strings.) FYI about string: o One drawback is that several statistical procedures require that all data be numerical. o To run analyses comparing males to females and use gender as the blocking variable, the data needs to be recoded as numeric (e.g., 1 for males and 2 for females). This will be discussed later. 3. Width Shows how many spaces could be maximally occupied by a data point in that column. SPSS selects 8 by default. However, if long values are being used, like last names or social security numbers, you would need to raise this value. 4. Decimals By default, SPSS inserts 2 decimals for each numerical value Values of 0 to 99 can be selected. Change the decimal places for Subject and Age to 0 5. Label If needed, type in a longer definition for your variable. The variable name is a brief, one-word descriptor. The variable label is often a sentence or phrase. For example, test could be further defined as Percent of correct answer out of 100 total questions. 6. Values If variables are coded in the data set (ex: gender with 1 = male and 2 = female), data values can be defined here. 1. For example, in gender, click in the corresponding cell under Values. 2. Then select the gray box on the right-hand side of the cell. 3. This will open a new window. 4. In the Value box, type in the value from the data view.
From: http://www.usd.edu/~aschwein/Stats/Tutorials/SPSS%20Tutorial.pdf
Basics of SPSS 6 of 13
5. In the Value Label box, type in the label you want to correspond with that value. In this case, type 1 in the Value box and male in the Value Label box, and then select Add. Then type 2 and female followed by Add. When we are finished defining the values, then select OK. 7. Align In the data view, where do you want the data points aligned (Left, Center, or Right). 8. Measure Define the measurement scale for each variable (Nominal, Ordinal, Interval, or Ratio). This will have bearing for custom tables. When the appropriate adjustments have been made, move back to the Data View by clicking on the Data View tab on the bottom left of the screen. Notice the variable names have changed and the alignment and decimals have changed to meet your specifications.
From: http://www.usd.edu/~aschwein/Stats/Tutorials/SPSS%20Tutorial.pdf
Basics of SPSS 7 of 13
Saving Data Select File, and then Save. Select the folder in which to save it using the Save In drop-down menu. Name your data file in the box labeled File Name. Identify the type of file you want to save: o SPSS: Can only be opened and used by SPSS, but all your formatting is maintained o Excel: Saved as an Excel spreadsheet. Some formatting maintained. Can be imported into SPSS. o Tab delimited: A text file in which the data is separated by tabs. This is convenient if it is to be opened and used by applications that cannot read Excel or SPSS files. Opening an Existing Data File Now that you have saved your data, if you want to use it again at a later date, you may do so. To open the data file either: 1. Select Open an existing data source from the opening window and select your data file from the window or by using the Browse button. 2. From the data window, in data view, select File, then Open. Search the folders for your file and click Open.
From: http://www.usd.edu/~aschwein/Stats/Tutorials/SPSS%20Tutorial.pdf
Basics of SPSS 8 of 13
Editing Data Inserting Variables Once your data set has been entered, you may decide to further edit it by inserting additional variables. 1. Click the column (variable name) to the right of where you want to enter the new variable. 2. Right-click on the variable name and choose: Insert Variable. 3. A new column will appear, named by SPSS, with periods as data points. 4. You may now enter new data in this column to replace the periods. Deleting Variables 1. Select the column (variable name) you wish to delete. 2. Hit: Delete on the keyboard. Or right-click the column (variable name) and select Clear. 3. The column will be removed. Inserting Cases/Rows 1. Highlight the row above where you want to insert a new one, by clicking on the row number. 2. Right click on the row number and select Insert Case. Deleting Cases/Rows 1. To delete a row, highlight the row to be deleted by clicking on the row number. 2. Hit Delete on the keyboard. Editing Data It is common to enter some data incorrectly. If this occurs, simply select the cell with the incorrect data point and type the correct data. This will replace the existing data point. FYI: the top of the page contains an information bar. You can change parts of an existing cell or add a character without overwriting what is currently in the cell by using the information bar. If you wanted to change mall to male, simply click on the cell with mall in it. Then click on the information bar. Move the cursor to the end of the word by clicking at the end or using the arrow keys. Delete the last l and type e. Then hit Enter once.
From: http://www.usd.edu/~aschwein/Stats/Tutorials/SPSS%20Tutorial.pdf
Basics of SPSS 9 of 13
Sorting Data Use this if you want to see variables sorted in ascending or descending order. 1. Go to: Data Sort Cases. This will bring up a new window. 2. Highlight the first variable to sort by in the left-hand box. 3. Click the right arrow to move it to the Sort by box. 4. Choose to sort in ascending or descending order of this variable. 5. If you want a second variable to sort by, follow steps 2-4. The data will first be sorted by the variable on the top of the Sort by box. Within that variable, the data will be sorted by the next variable in the list.
This is what the data would look like if it were sorted by gender, then age:
Printing Data To print all of the data, select File, then Print. To print some of the data, highlight the data to be printed, select File, then Print, then click Selection.
From: http://www.usd.edu/~aschwein/Stats/Tutorials/SPSS%20Tutorial.pdf
Basics of SPSS 10 of 13
Manipulating Data Select Cases and Filter Data Use this command when analyzing all the data in the data set is unnecessary Filter out certain rows. 1. Go to Data Select Cases. 2. Select If Condition is Satisfied and click on the If. 3. This brings up a new window giving choices to identify the conditions under which cases will be selected.
Expression for selection of cases. Variables available for use in selecting cases. Criteria that can be used in developing expressions for selection.
4. 5. 6. 7. 8. 9.
Ex: Subject 5 cheated and will not be used in analysis. In this case, select all subjects that are not equal to 5: Use an expression stating subject~=5. To do this, highlight subject in the right-hand box. Move it to the expression box using the right-arrow button. Then, either type or click the corresponding button to build your selection expression. Some of the terms are: ~ Not ** Exponent & And | Logical Or. (True if the expression before or after the | is true.)
Filter out subgroups 1. To filter out subgroups of data, follow the same procedures, except identify the subgroup(s) to maintain in the selection expression. 2. Ex: to analyze data belonging to females, enter the following expression: Sex=2. (To do this, the data needs to be classified as numeric and not string.)
From: http://www.usd.edu/~aschwein/Stats/Tutorials/SPSS%20Tutorial.pdf
Basics of SPSS 11 of 13
3. Whenever variables are filtered out, SPSS creates a new variable (filter_$) that identifies whether or not a case is selected for use or not. Those cases that were filtered out (not selected) are also identified by a slash across their row number. Recode Data Recoding data assigns new values to existing data, or collapses subsets of data into new values. 1. Ex: to group the six students by whether they scored high or low on the test. 2. Select Transform Recode.
Variable available to recode.
Expression stating that you are recoding the old variable to a new variable. Name and create a label for the new variable. Then click Change.
3. At this point you have the option of recoding to the same or different variables. To recode to the same variable would replace the existing data with the new codes. To recode to a different variable would create a new variable with the new codes. The second is almost always my preference because it allows you to retain your original data. 4. Test was selected to recode into a new variable called New_test. To identify the new values, click Old and New Values.
From: http://www.usd.edu/~aschwein/Stats/Tutorials/SPSS%20Tutorial.pdf
Basics of SPSS 12 of 13
5. Identify the old value or range of values and the new, recoded value. Either recode individual values or a range of values.
6. In this case, all test scores less than 80 were considered low and all that were 80 or higher were considered high. 7. For the low range, select Range, Lowest Through Value and type 79 for Old Value. 8. For new value, if the output is a string variable as it is here, check, Output variables are strings, and enter the new value to match the old range (Low). Then click Add. 9. For the high range, the parameters are listed in the window above. Then click Add. 10. Click Continue when done. 11. SPSS creates a new variable with the recoded values:
From: http://www.usd.edu/~aschwein/Stats/Tutorials/SPSS%20Tutorial.pdf
Basics of SPSS 13 of 13
Transform Data New variables can be computed as a function of old variables. New variables can be: o sum of two old variables o square root of an old variable o There are almost infinite possibilities for transforming data. 1. To transform data, select Transform Compute. 2. Use the expression builder to design your new variable:
3. In Target Variable, type the name of the new variable that will contain the transformed values. 4. The Numeric Expression box identifies how to compute the transformed values. Use this box similarly to that used in Selecting Cases. 5. Here, a new variable was created that is equal to the square root of test. 6. SPSS will create a new variable with values equal to the square root of test for each case.
From: http://www.usd.edu/~aschwein/Stats/Tutorials/SPSS%20Tutorial.pdf