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