Return to Video

Computing a new variable in SPSS

  • 0:01 - 0:03
    So here we are in SPSS
  • 0:03 - 0:04
    I have created kind of a
  • 0:04 - 0:05
    a junk data set
  • 0:05 - 0:07
    just to help illustrate
  • 0:07 - 0:08
    how we can compute variables
  • 0:08 - 0:10
    or compute new variables
  • 0:10 - 0:12
    using the values from existing ones.
  • 0:12 - 0:14
    This is a pretty straight forward process,
  • 0:14 - 0:15
    it looks a little bit different
  • 0:15 - 0:17
    than things that we've done before
  • 0:17 - 0:19
    or other ways that we are going
  • 0:19 - 0:20
    to be using SPSS in this course.
  • 0:20 - 0:22
    So it might look a little bit different,
  • 0:22 - 0:24
    but it is pretty straight forward
  • 0:24 - 0:25
    and pretty easy
  • 0:25 - 0:26
    once you know how to do this.
  • 0:26 - 0:28
    So the first thing that we'll do
  • 0:28 - 0:30
    is to go to Transform and then
  • 0:30 - 0:31
    the first option we have there
  • 0:31 - 0:33
    is compute variable. So click on that.
  • 0:34 - 0:36
    We get this new window that pops up
  • 0:36 - 0:38
    The first thing that we really want
  • 0:38 - 0:39
    to look at is in the top left and
  • 0:39 - 0:42
    and that's this target variable uh window.
  • 0:43 - 0:44
    Basically what the computer
  • 0:44 - 0:45
    is asking you
  • 0:45 - 0:47
    is to create a name for the new variable
  • 0:47 - 0:49
    that you are going to be computing.
  • 0:49 - 0:51
    This name needs to be unique,
  • 0:51 - 0:53
    it's one that can't have spaces in it
  • 0:53 - 0:55
    and it should avoid special characters.
  • 0:55 - 0:56
    But
  • 0:56 - 0:58
    in this case, what I like to do
  • 0:58 - 1:00
    is include some sort of piece
  • 1:00 - 1:01
    of information in there
  • 1:01 - 1:03
    in the naming convention I use
  • 1:03 - 1:05
    that helps me know what this is
  • 1:05 - 1:06
    just by looking at it.
  • 1:06 - 1:08
    So what we're going to be doing
  • 1:08 - 1:09
    is we are going to be summing items
  • 1:09 - 1:12
    1, 2, 3, 4, 5, 6 together,
  • 1:12 - 1:13
    adding those together.
  • 1:13 - 1:14
    So an easy way to do that,
  • 1:14 - 1:16
    is just to put sum of items.
  • 1:18 - 1:21
    That way when I look at this new variable
  • 1:21 - 1:22
    once it's generated
  • 1:22 - 1:23
    I know that that's the variable
  • 1:23 - 1:25
    that I really want to be working with.
  • 1:25 - 1:27
    Or running my tests on because that
  • 1:27 - 1:29
    that contains the information
  • 1:29 - 1:30
    from the other ones.
  • 1:30 - 1:33
    You can click on type and label.
  • 1:34 - 1:35
    The label is the more
  • 1:35 - 1:36
    drawn out explanation,
  • 1:36 - 1:38
    that's the one you can include character
  • 1:38 - 1:40
    additional characters or spaces
  • 1:40 - 1:41
    and special characters.
  • 1:41 - 1:42
    In our case,
  • 1:42 - 1:44
    I'm going to put this is the sum
  • 1:45 - 1:46
    of items
  • 1:47 - 1:49
    1 through 6.
  • 1:49 - 1:51
    And that way, I know that
  • 1:51 - 1:52
    that is going to a
  • 1:52 - 1:53
    give me a more
  • 1:54 - 1:55
    drawn out explanation of what
  • 1:55 - 1:57
    this variable includes.
  • 1:57 - 1:58
    We know this is
  • 1:58 - 2:00
    going to be uneric - numeric - I'm sorry,
  • 2:00 - 2:01
    so click Continue.
  • 2:01 - 2:03
    The next thing we are going to
  • 2:03 - 2:05
    look at is this numeric expression box
  • 2:05 - 2:06
    Um we're actually come back
  • 2:06 - 2:07
    to this in just a minute.
  • 2:07 - 2:09
    But this is where you're going to be doing
  • 2:09 - 2:10
    most of the work
  • 2:10 - 2:12
    when you're computing a variable.
  • 2:12 - 2:13
    What you want to go to next
  • 2:13 - 2:15
    is this function group area.
  • 2:15 - 2:16
    So I'm going to click on all
  • 2:17 - 2:18
    and you notice right below it
  • 2:18 - 2:20
    we've got these functions
  • 2:20 - 2:21
    and special variables
  • 2:21 - 2:23
    and this popped up when I clicked on all.
  • 2:23 - 2:24
    This has a whole bunch
  • 2:24 - 2:26
    of different pre-existing functions,
  • 2:26 - 2:28
    so you don't need to reinvent the wheel.
  • 2:28 - 2:30
    You can basically use these pre-existing
  • 2:30 - 2:31
    functions to help you compute
  • 2:31 - 2:33
    this new variable.
  • 2:33 - 2:35
    Um, I'm going to go down to sum
  • 2:35 - 2:36
    and these are in alphabetical order
  • 2:36 - 2:38
    so it's pretty easy to find.
  • 2:38 - 2:40
    Here we have sum and when I click on sum,
  • 2:40 - 2:42
    you'll notice that this box to the left
  • 2:42 - 2:43
    populated with some text.
  • 2:44 - 2:46
    This box is actually pretty useful.
  • 2:46 - 2:47
    So the first thing it shows you
  • 2:47 - 2:49
    is an example of what this expression
  • 2:49 - 2:50
    is going to be.
  • 2:50 - 2:51
    I know expression
  • 2:51 - 2:52
    sounds likes a really fancy term,
  • 2:52 - 2:54
    if you've ever used a formula in Excel
  • 2:54 - 2:56
    it's basically that.
  • 2:56 - 2:57
    It's telling the computer
  • 2:57 - 2:58
    what it needs to do.
  • 2:58 - 3:00
    In this case, just like Excel,
  • 3:01 - 3:02
    we've got the word sum,
  • 3:02 - 3:03
    which tells the computer it's going
  • 3:03 - 3:05
    to be summing different values together.
  • 3:05 - 3:07
    And then in parenthesis,
  • 3:07 - 3:08
    immediately after that,
  • 3:08 - 3:09
    we have different variables
  • 3:09 - 3:10
    that are separated by a comma
  • 3:10 - 3:12
    and that's what tells the computer
  • 3:12 - 3:14
    to add x, y, and z things together
  • 3:14 - 3:16
    to create a new variable
  • 3:16 - 3:18
    or compute a new variable.
  • 3:18 - 3:19
    This also provides additional
  • 3:19 - 3:21
    extra content here,
  • 3:21 - 3:22
    but we don't need to worry about that.
  • 3:22 - 3:24
    I've found this is helpful if
  • 3:24 - 3:25
    you are stuck or
  • 3:25 - 3:26
    something isn't working right.
  • 3:26 - 3:28
    So we've got sum selected,
  • 3:28 - 3:29
    we're going to be summing the items
  • 3:29 - 3:32
    of 1, 2, 3, 4, 5, and 6 together.
  • 3:32 - 3:33
    We've got that selected.
  • 3:33 - 3:34
    So the next thing you do
  • 3:34 - 3:35
    is click this up arrow
  • 3:35 - 3:36
    which basically takes that
  • 3:36 - 3:38
    pre-existing function
  • 3:38 - 3:39
    and it kicks it up
  • 3:39 - 3:40
    to this numeric expression box.
  • 3:42 - 3:43
    The next thing that we're going to do,
  • 3:43 - 3:45
    we've already told the computer
  • 3:45 - 3:46
    that we're going to sum
  • 3:46 - 3:48
    different variables together,
  • 3:48 - 3:49
    We need to tell it which variables
  • 3:49 - 3:50
    to sum together.
  • 3:50 - 3:52
    So the easy way to do this
  • 3:52 - 3:54
    is to click on
  • 3:54 - 3:55
    the first item that you want to include
  • 3:56 - 3:58
    and you'll notice that this arrow
  • 3:58 - 3:58
    switched sides
  • 3:58 - 4:00
    from pointing to the left
  • 4:00 - 4:01
    to pointing to the right,
  • 4:01 - 4:02
    click over one,
  • 4:02 - 4:04
    and we've already moved over item one.
  • 4:05 - 4:06
    What you need to be careful of
  • 4:06 - 4:08
    is that you always have a comma
  • 4:08 - 4:09
    after each variable
  • 4:10 - 4:11
    except for the last one.
  • 4:11 - 4:13
    So a comma is already here,
  • 4:13 - 4:14
    but what I usually do
  • 4:14 - 4:15
    is I just hit a comma
  • 4:15 - 4:16
    I go to item 2,
  • 4:17 - 4:18
    kick that over,
  • 4:18 - 4:19
    comma,
  • 4:19 - 4:20
    item 3,
  • 4:20 - 4:21
    kick that over,
  • 4:21 - 4:22
    comma,
  • 4:22 - 4:23
    item 4,
  • 4:23 - 4:24
    kick that over,
  • 4:24 - 4:25
    comma,
  • 4:25 - 4:25
    item 5,
  • 4:25 - 4:26
    kick that over,
  • 4:26 - 4:27
    comma,
  • 4:27 - 4:28
    item 6,
  • 4:28 - 4:29
    kick that over.
  • 4:29 - 4:30
    Now we know that item 6
  • 4:30 - 4:32
    is the last one we have,
  • 4:32 - 4:33
    the last variable we're including.
  • 4:33 - 4:35
    So what we're going to do is just
  • 4:35 - 4:36
    delete out that question mark,
  • 4:36 - 4:38
    we're going to delete out that last comma
  • 4:38 - 4:40
    and then if we read through this
  • 4:40 - 4:41
    real quick just to make sure
  • 4:41 - 4:43
    we don't have any problems
  • 4:43 - 4:44
    we've got creating sum of items,
  • 4:46 - 4:48
    this is going to be the sum of item 1,
  • 4:48 - 4:51
    2, 3, 4, 5, and 6
  • 4:52 - 4:54
    and what we're going to do now is click OK
  • 4:55 - 4:57
    An output window pops up and it basically
  • 4:57 - 4:59
    tells you what the computer did
  • 4:59 - 5:00
    it computed the sum of items,
  • 5:00 - 5:01
    which was the sum
  • 5:01 - 5:03
    of item 1, 2, 3, 4, 5, and 6
  • 5:03 - 5:05
    it gives us the variable label.
  • 5:05 - 5:08
    It gives us that descriptive text I put in
  • 5:08 - 5:10
    I'm just going to minimize this window
  • 5:10 - 5:11
    and if we look back here,
  • 5:11 - 5:13
    you might notice that there is this
  • 5:13 - 5:14
    new column,
  • 5:14 - 5:15
    this new variable, that sum of items,
  • 5:15 - 5:17
    that wasn't there when we started
  • 5:17 - 5:19
    and that's because SPSS computed that
  • 5:19 - 5:21
    and if we add these together
  • 5:21 - 5:22
    if you add each row
  • 5:22 - 5:24
    you've got 1-2-1-3-5-1
  • 5:25 - 5:26
    that adds to 13.
  • 5:27 - 5:29
    5-1-2-3-5-1
  • 5:29 - 5:30
    adds to 17.
  • 5:30 - 5:32
    So it's done that math for us,
  • 5:32 - 5:33
    we didn't have to manually do it.
  • 5:33 - 5:35
    I know yes it would be pretty easy
  • 5:36 - 5:38
    to manually do this for ten cases
  • 5:38 - 5:39
    but if you have a data set
  • 5:39 - 5:41
    that has 500 cases
  • 5:41 - 5:43
    that would be very time-consuming to do.
  • 5:43 - 5:45
    And you can see that this kind of function
  • 5:45 - 5:47
    of computing this variable,
  • 5:47 - 5:48
    can save you a lot of time.
  • 5:48 - 5:50
    It's also more accurate.
  • 5:50 - 5:51
    It's going to take
  • 5:51 - 5:52
    any sort of error out of the prob, ugh,
  • 5:52 - 5:54
    error out of the equation.
  • 5:54 - 5:55
    And we know that, often,
  • 5:55 - 5:56
    when we do things by hand,
  • 5:56 - 5:58
    we can introduce error into things.
  • 5:58 - 5:59
    So we want to avoid that.
  • 6:00 - 6:02
    That's one way to compute a variable.
  • 6:02 - 6:04
    I'm going to show you one other way that
  • 6:04 - 6:05
    a different type of variable
  • 6:05 - 6:06
    that we can compute.
  • 6:06 - 6:07
    I'm going to go back to transform
  • 6:07 - 6:09
    I'm going to go back to compute variable
  • 6:09 - 6:11
    I'm actually gonna clear this out
  • 6:11 - 6:12
    we're done with sum of items
  • 6:12 - 6:14
    we don't need to worry about it
  • 6:14 - 6:16
    we're not gonna use the same expression
  • 6:16 - 6:17
    so when I click reset
  • 6:17 - 6:18
    in the bottom here.
  • 6:18 - 6:20
    So what I want to do is create the mean
  • 6:20 - 6:22
    of the different items that we have.
  • 6:23 - 6:24
    Sometimes if you are working
  • 6:24 - 6:26
    with a pre-existing scale
  • 6:26 - 6:28
    it might tell you to um
  • 6:28 - 6:29
    add all the items together
  • 6:29 - 6:31
    and then that's what represents
  • 6:31 - 6:34
    that theoretical concept or that measure.
  • 6:34 - 6:37
    Sometimes it might tell you to use the mean
  • 6:37 - 6:38
    so what I want to do
  • 6:38 - 6:39
    is compute both of these things,
  • 6:39 - 6:41
    because they both might be helpful to me.
  • 6:41 - 6:43
    So what I'm going to do,
  • 6:43 - 6:44
    is I'm going to type mean of items
  • 6:45 - 6:47
    and again, that very quickly,
  • 6:47 - 6:48
    let's me differentiate between
  • 6:48 - 6:50
    sum of items and mean of items,
  • 6:50 - 6:51
    type and label,
  • 6:51 - 6:53
    and again, I'm just going to put
  • 6:53 - 6:55
    mean of items one through six.
  • 7:00 - 7:01
    Click continue.
  • 7:02 - 7:04
    Just like we did before
  • 7:04 - 7:05
    click on all
  • 7:05 - 7:07
    and then we're going to go down to mean.
  • 7:09 - 7:10
    Here's mean.
  • 7:10 - 7:12
    And when I click on that, again,
  • 7:12 - 7:14
    it gives me that sample text here,
  • 7:14 - 7:16
    this is very similar to what we did before
  • 7:16 - 7:18
    I'm going to click up
  • 7:19 - 7:21
    and we're going to kick over 1
  • 7:21 - 7:22
    comma
  • 7:22 - 7:23
    2
  • 7:23 - 7:23
    comma
  • 7:23 - 7:24
    3
  • 7:24 - 7:25
    comma
  • 7:25 - 7:26
    4
  • 7:26 - 7:27
    comma
  • 7:27 - 7:28
    5
  • 7:29 - 7:30
    and then 6
  • 7:30 - 7:30
    I'm making sure to
  • 7:30 - 7:32
    not include this last one
  • 7:32 - 7:33
    this sum of items
  • 7:33 - 7:35
    and then just like last time,
  • 7:35 - 7:36
    we're going to delete out
  • 7:36 - 7:37
    that question mark
  • 7:37 - 7:37
    that last comma
  • 7:37 - 7:39
    we're going to read through it
  • 7:39 - 7:41
    really quickly just to avoid an error
  • 7:41 - 7:42
    we've got a new variable,
  • 7:42 - 7:43
    the mean of items.
  • 7:43 - 7:44
    It's going to be the mean
  • 7:44 - 7:47
    of item 1, 2, 3, 4, 5, and 6
  • 7:47 - 7:49
    I'm going to click OK
  • 7:50 - 7:52
    SPSS again showed me
  • 7:52 - 7:54
    kind of the syntax of what it did.
  • 7:54 - 7:56
    I'm going to minimize that.
  • 7:56 - 7:58
    And then here we have the mean of items.
  • 7:58 - 8:00
    And if we really quickly look at this
  • 8:00 - 8:02
    I'm gonna pick this one for example,
  • 8:02 - 8:06
    we've got um 1-1-3-3-1-2
  • 8:06 - 8:08
    and a mean of 1.83 would
  • 8:08 - 8:09
    just eyeballing it
  • 8:09 - 8:10
    kind of make sense.
  • 8:10 - 8:12
    If we look at this one, 3.67
  • 8:13 - 8:15
    2-3-5-4-5-3
  • 8:15 - 8:17
    that would roughly make sense
  • 8:17 - 8:19
    without having to do the math of it
  • 8:19 - 8:21
    but this is computed the average score
  • 8:21 - 8:24
    the mean score for all six of those items.
  • 8:24 - 8:27
    Um so that is very quickly how to compute
  • 8:27 - 8:29
    a new variable in SPSS
  • 8:29 - 8:31
    This is particularly useful when
  • 8:31 - 8:32
    you have collected data
  • 8:32 - 8:33
    using a pre-existing measure
  • 8:33 - 8:35
    and that measure has instructed you
  • 8:35 - 8:37
    to compute the sum of items
  • 8:37 - 8:39
    and run your tests on that.
  • 8:39 - 8:40
    Or maybe the mean of items
  • 8:40 - 8:41
    and run your tests on that.
  • 8:41 - 8:44
    But this is a useful way of understanding
  • 8:44 - 8:45
    how to create new variables
  • 8:45 - 8:47
    using existing ones in SPSS.
Title:
Computing a new variable in SPSS
Description:

This video will show you how to compute the sum of multiple existing variables and how to compute the mean of multiple existing variables.

more » « less
Video Language:
English
Duration:
08:48

English subtitles

Revisions Compare revisions