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 an 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:27 - 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 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:57
    in this case, what I like
  • 0:57 - 1:00
    to do 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
    one, two, three, four, five, six 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
    one through six.
  • 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 pop 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:06
    to be summing different values together.
  • 3:06 - 3:07
    And then in parenthesis,
  • 3:07 - 3:08
    immediately after that,
  • 3:08 - 3:10
    we have different variables
  • Not Synced
    that are separated by a comma
  • Not Synced
    and that's what tells the computer
  • Not Synced
    to add x, y, and z things together
  • Not Synced
    to create a new variable
  • Not Synced
    or compute a new variable.
  • Not Synced
    This also provides additional
  • Not Synced
    extra content here, but we don't need to
  • Not Synced
    worry about that. I've found this
  • Not Synced
    is useful if you are stuck or something
  • Not Synced
    isn't working right.
  • Not Synced
    So we've got some selected,
  • Not Synced
    we're going to be summing the items
  • Not Synced
    of one, two, three, four, five, and six
  • Not Synced
    together. We've got that selected.
  • Not Synced
    So the next thing you do
  • Not Synced
    is click this up arrow
  • Not Synced
    which basically takes that pre-existing function
  • Not Synced
    and kicks it up to this
  • Not Synced
    numeric expression box.
  • Not Synced
    The next thing that we're going to do,
  • Not Synced
    we've already told the computer
  • Not Synced
    that we're going to sum
  • Not Synced
    different variables together,
  • Not Synced
    We need to tell it which variables
  • Not Synced
    to sum together.
  • Not Synced
    So the easy way to do this
  • Not Synced
    is to click on the first item
  • Not Synced
    we want to include and you'll notice that
  • Not Synced
    this arrow switched sides
  • Not Synced
    from pointing to the left to pointing
  • Not Synced
    to the right, click over one,
  • Not Synced
    and we've already moved over item one.
  • Not Synced
    What you need to be careful of
  • Not Synced
    is that you always have a comma
  • Not Synced
    after each variable except for the last one.
  • Not Synced
    So a comma is already here,
  • Not Synced
    but what I usually do is I just hit a comma
  • Not Synced
    I go to item two, kick that over,
  • Not Synced
    comma, item three, kick that over,
  • Not Synced
    comma, item four, kick that over,
  • Not Synced
    comma, item five, kick that over,
  • Not Synced
    comma, item six, kick that over.
  • Not Synced
    Now we know that item six
  • Not Synced
    is the last one we have,
  • Not Synced
    the last variable we're including.
  • Not Synced
    So what' we're going to do is just delete
  • Not Synced
    out that question mark, we're going to
  • Not Synced
    delete out that last comma and
  • Not Synced
    then if we read through this real quick
  • Not Synced
    just to make sure we don't have any problems
  • Not Synced
    we've got creating sum of items,
  • Not Synced
    this is going to be the sum of item one,
  • Not Synced
    two, three, four, five, and six
  • Not Synced
    and what we're going to do now is click OK
  • Not Synced
    An output window pops up and basically
  • Not Synced
    tells you what the computer did
  • Not Synced
    it computed the sums, which was the sum
  • Not Synced
    of items one, two, three, four, five, and six
  • Not Synced
    it gives us the variable label.
  • Not Synced
    It gives us that descriptive text I put in
  • Not Synced
    I'm just going to minimize this window
  • Not Synced
    and if you look back here, you might
  • Not Synced
    notice that there is this new column,
  • Not Synced
    this new variable, this sum of items,
  • Not Synced
    that wasn't there when we started
  • Not Synced
    and that's because SPSS computed that
  • Not Synced
    and if we add these together
  • Not Synced
    if you add each row
  • Not Synced
    you've got one two one three five one
  • Not Synced
    that adds to thirteen.
  • Not Synced
    Five one two three five one
  • Not Synced
    adds to seventeen.
  • Not Synced
    So it's done that math for us, you didn't
  • Not Synced
    have to manually do it.
  • Not Synced
    I know yes it would be pretty easy
  • Not Synced
    to manually do this for ten cases
  • Not Synced
    but if you have a data set
  • Not Synced
    that has five hundred cases
  • Not Synced
    that would be very time-consuming to do.
  • Not Synced
    And you can see, that this kind of function,
  • Not Synced
    of computing this variable, can save you
  • Not Synced
    a lot of time. It's also more accurate
  • Not Synced
    It's going to take any sort of error
  • Not Synced
    out of the process, error out of the
  • Not Synced
    equation. And we know that, often,
  • Not Synced
    when we do things by hand,
  • Not Synced
    we can introduce error into things.
  • Not Synced
    So we want to avoid that.
  • Not Synced
    That's one way to compute a variable.
  • Not Synced
    I'm going to show you one other way
  • Not Synced
    a different type of variable
  • Not Synced
    that we can compute.
  • Not Synced
    I'm going to go back to transform
  • Not Synced
    I'm going to go back to compute variable
  • Not Synced
    I'm actually going to clear this out
  • Not Synced
    we're done with sum of items
  • Not Synced
    we don't need to worry about it
  • Not Synced
    we'renot going to use the same expression
  • Not Synced
    so we click reset in the bottom here
  • Not Synced
    so what I want to do is create the mean
  • Not Synced
    of the different items that we have.
  • Not Synced
    Sometimes if you are working
  • Not Synced
    with a pre-existing scale
  • Not Synced
    it might tell you to add all the items
  • Not Synced
    together and then that's what represents
  • Not Synced
    that theoretical concept or that measure.
  • Not Synced
    Sometimes it might tell you to use the mean
  • Not Synced
    so what I want to do is compute
  • Not Synced
    both of these things. because they both
  • Not Synced
    might be helpful to me.
  • Not Synced
    So what I'm going to do,
  • Not Synced
    is I'm going to type in mean of items
  • Not Synced
    and again, that very quickly, let's me
  • Not Synced
    differentiate between sum of items
  • Not Synced
    and mean of items, type of label
  • Not Synced
    again, I'm just going to put mean of items
  • Not Synced
    one through six
  • Not Synced
    Click continue
  • Not Synced
    Just like we did before
  • Not Synced
    click on all and then
  • Not Synced
    we're going to go down to mean.
  • Not Synced
    Here's mean.
  • Not Synced
    And when I click on that, again,
  • Not Synced
    it gives me that sample text here,
  • Not Synced
    this is very similar to what we did before
  • Not Synced
    I'm going to click up
  • Not Synced
    and we're going to kick over one
  • Not Synced
    comma two comma three comma four
  • Not Synced
    comma five and then six.
  • Not Synced
    I'm making sure to include this last one
  • Not Synced
    this sum of items
  • Not Synced
    and then just like last time,
  • Not Synced
    we're going to delete out that question mark
  • Not Synced
    that last comma
  • Not Synced
    we're going to read through it
  • Not Synced
    really quickly just to avoid an error
  • Not Synced
    we've got a new variable, the mean of item
  • Not Synced
    one two three four five and six
  • Not Synced
    I'm going to click OK
  • Not Synced
    SPSS again showed me the syntax of kind of
  • Not Synced
    what it did. I'm going to minimize that.
  • Not Synced
    And then here we have the mean of items.
  • Not Synced
    And if we really quickly look at this
  • Not Synced
    I'm gonna pick this one for example,
  • Not Synced
    we've got one one three three one two
  • Not Synced
    and a mean on 1.83 would just eyeballing it
  • Not Synced
    kind of make sense.
  • Not Synced
    If we look at this one, 3.67
  • Not Synced
    Two three five four five three
  • Not Synced
    that would roughly make sense
  • Not Synced
    without having to do the math of it
  • Not Synced
    but this is computed the average score
  • Not Synced
    the mean score for all six of those items
  • Not Synced
    and that is very quickly how to compute
  • Not Synced
    a new variable in STSS
  • Not Synced
    This is particularly useful when
  • Not Synced
    you have collected data using a pre-existing
  • Not Synced
    measure and that measure has instructed you
  • Not Synced
    to compute the sum of items
  • Not Synced
    and run your tests on that.
  • Not Synced
    Or maybe the mean of items
  • Not Synced
    and run your tests on that.
  • Not Synced
    But this is a useful way of understanding
  • Not Synced
    how to create new variables
  • Not Synced
    using existing ones in SPSS.
Title:
Computing a new variable in SPSS
Description:

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

English subtitles

Revisions Compare revisions