Outline

  • Basics features of SPSS
    • how to open/save a file
    • look at a data window
    • learn about variables & cases
    • how to enter/change data
    • scales of measurement
psy138 banner

Lab 2

Data & Spreadsheets

SPSS basics: Entering data

SPSS is a spreadsheet, which is a kind of computer program for manipulating datasets. Data are entered into a matrix; each row is for a separate case and each column is for a different variable. Spreadsheets are used in many contexts, such as accounting, inventorying, and research. Spreadsheets replace calculators! They include all the functions on advanced calculators, provide a visible data-entry format, have graphing options, are programmable, produce a savable file, and can be incorporated into other computer documents.

You might already be familiar with MS Excel, which is a general-purpose spreadsheet. SPSS is a more powerful program developed specifically to analyze research data in the social sciences. ISU licenses it for use on a certain number of computers on campus, including in the DEG 13 lab, the Psychological Resources Center next door, and other computer labs around campus, including the one in Milner library. (They should all have the same version.) It is not standard software for campus computers, so it is not on the computers in the lobby of Milner library or in other public places on campus. There is a student version that you can purchase for your own computer. It is adequate for the statistics covered in PSY 138 and PSY 340. You should practice using SPSS outside of laboratory times!

Creating a data file

Your task is to create a data file in SPSS based on the data below. If you want to save your dataset at this point skip to the end of the lab for instructions about saving.  If you want to enter data now and then save, then keep reading along. Below are the step-by-step instructions for this task. (In the labs, the instructor will demonstrate software, so you will not need to read everything; instructions are in Lab Texts for reference.)

      spssgif

Start the programs


    Click on the SPSS icon at the bottom of the computer screen. When the program starts it should open up an empty data window. If at this point you wanted to open an existing datafile, you'd go to the file menu and open the file. However for this part of the exercise we want to create a new datafile, so the empty data window is what we want.

Examine the data to be entered

Now you want to take a look at the data that you'll be entering. You need to identify the cases (to go into the rows of the data files) and the variables (to go into the columns). Note that the information includes both numerical and verbal entries.

 

      ID#01
      Name: Joe Hart
      Age: 25
      Gender: Male
      Income: $23,000
      IQ: 105

      ID#: 02
      Name: Mary Swanson
      Age: 37
      Gender: Female
      Income: $41,000
      IQ: 115

      ID#: 03
      Name: Sam Lewis
      Age: 61
      Gender: Male
      Income: ?
      IQ: 125

      ID#: 04
      Name: Chin Lee
      Age: 32
      Gender: Male
      Income: $36,000
      IQ: 140

      ID#: 05
      Name: Al Walton
      Age: 39
      Gender: Male
      Income: $29,000
      IQ: 95

      ID#: 06
      Sara Smith
      Age: 27
      Gender: Female
      Income: $18,000
      IQ: 90

      ID#: 07
      Name: David Dodge
      Age: 34
      Gender: Male
      Income: $29,000
      IQ: 115

      ID#: 08
      Name: Michelle Friedlander
      Age: 38
      Gender: Female
      Income: $22,000
      IQ: 105

Enter the data

    SPSS. The opening page is the Data View. But SPSS also has a Variable View (click on it at the bottom of the page). The pictures of SPSS presented below and in other lab texts at should look similar to what you'll see in SPSS version 22. Other versions of SPSS may look slightly different.

      The data view

    The variable view

    You can set up your SPSS datafile using either view, however which one you start with will change the procedure a bit. 

    Starting with the Data view
    If you start by entering in data, SPSS automatically formats the column based on the first thing that you type in. If you enter a number, but then later decide to use the column for words, you'll need to go to the Variable View to change the format to String. If you type in a word (e.g., a last name) that is short, SPSS will set the width of that column equal to the number of letters in the word. Then if for the next case you want to type in a longer word, you'll need to go to the Variable View and change the setting for Width. If you are still having trouble, ask your lab neighbor or instructor for assistance.

    Starting with the Variable view

    In this view, each row is for a different variable. If you start with this view, then you are essentially setting up the formatting for each of the columns in the Data View first.  For example, the first row corresponds to the variable IDnumber, the second row to Lastname (depending on how you set it up, it could also be last name or first name), the next to Firstname, Age, etc. The columns on this spreadsheet are the characteristics of the variables and their formatting.
        Name - SPSS enters a default name, such as VAR0001. You can rename the variable, using no more than 8 characters and with no spaces.

Suggestions about variable names

  1. The variable name should be a description of the variable, if possible. If the variable can’t be succinctly described in the name, be sure to describe it in the Label column. I promise you that otherwise you will forget what the variable is if you put the data set away and then return to it months or years later. If you have a longitudinal study of couples, one of your variables might be DepressionWifeTime1 and you can label the variable Wife’s level of depression at the beginning of the study.
  2. Periods and underscores are useful to show that some variables are grouped together. for example, if you measure the height of children twice a year for 3 years starting in 2007, you could name the variables like this: height.2007.1
    height.2007.2
    height.2008.1
    height.2008.2
    height.2009.1
    height.2009.2

        Type - This refers to the kind of data that is being inputted into the cells. Numeric and String (for letters or other characters) are the most common. Income can be changed by clicking on Numeric and changing it to Dollar; also, other changes can be made in the popup window. Decimal Places can be changed to zero.

        Width - This is the number of characters that the data cell will allow within it. The defualt is 8, which is wider than necessary for many kinds of data, but not wide enough for some variables, such as last names. Setting it at 12 should be wide enough to fit entire names. (Width can also be set in the Type popup window.)

        Decimals - This is the number of places after the decimal place. For ID number, none is required so you can move it down to zero. (We already changed decimals for Income in the Type popup window.)

        Labels - This allows you to give your variables a longer, more detailed name (not limited to 8 characters and containing spaces). For example, for income, you could enter a label like "Income earned in 1999."

      Values - These are VERY IMPORTANT for CATEGORICAL variables. When entering gender into the data file, you probably typed in Male and Female. While this looks fine, it isn't the way that gender is usually inputted if you want to use the variable in an analysis. They need to be coded as numbers.

      So Male can be 1 and Female 2 (or vice versa, just be consistent). Then you can use the values to specify that 1 = male and 2 = female.

      Enter the number of the category in the Value field and the name of the category in the Value label field. Then click the Add button.

      You can get the data view spreadsheet to list categorical variables by their numbers or their labels by clicking the label button in the variable view menu (above the Missing column).

      A simpler common way of dealing with categorical variables is to enter their number codes directly on the data view.

      Missing - This is a little more complicated in SPSS than in programs like Excel. A blank is treated as zero. A specific code must be assigned as a missing value. None is the default. It must be changed for income, which is missing for case 3 above. Click on none and open the pop-up menu. Enter a discrete value as the code for missing data, e.g., -1. Any case that receives this code will be excluded from analyses involving income.

      Columns - This specifies how wide you want the variable column to look in the data window. If is is smaller than Width, the entry will be truncated.

      Align - This specifies how the data should be aligned in a column. Your choices are centered, left, and right.

      Measure - This column specifies the variable's scale of measurement. The three options are Scale, which covers both interval and ratio scales, Ordinal and Nominal.

    Role - We will ignore this column for now. Input is the default value.

    So in the end your variable view (minus the last column) should look something like this.

    When you have completed all of your data entry, save your SPSS file. 

Saving your data set

  1. Save your data set often. I have had heartbreaking events happen because I failed to save my data often. I’ve had power outages, software crashes, computer failures, roommate interference, pet interference, and my own general stupidity cause me to have re-do hours of work. Save often. A lot. Frequently. Really. I’m not kidding. Hitting the ctrl-S shortcut key is a quick and easy way to save data in SPSS (and most other programs).
  2. It is a good idea to put the date in the name of the file. In this course, your data will be neat and clean. In real data analysis, you often have multiple copies of similar data sets so it is helpful to know which is the most recent one. Note that dates cannot have slashes (e.g., 1/16/2008) in file names because Windows interprets slashes as folders.
  3. Name your data set something descriptive rather than "Data" or something like that. If the study is about the effect of journaling on stress related illnesses, call it "Journaling and Stress 1-16-2008".

Click File. Click Save (or click the Save button or press the ctrl-S shortcut keys). Name your data set "Lab 2" followed by your section number, your last name, and today’s date. If your name is Jones and you are in section 2, save the file as "Lab 2 Section 2 Jones 1-16-2007". This will help your GA know whose file is whose.

Then go to the Lab 2 Assignment in ReggieNet and upload your SPSS datafile.