>> So here we are in SPSS. I have created 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 straightforward process. It looks a little bit different than things that we've done before or other ways that we're going to be using SPSS in this course. So it might look a little bit different, but it is pretty straightforward and pretty easy once you know how to do this. So the first thing that we'll do is 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 that's this target variable window. Basically what the computer is asking you is to create a name for the new variable that you're 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 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're going to be summing items 1, 2, 3, 4, 5, and 6 together, adding those together. So an easy way to do that is just to put sumofitems. 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 contains the information from the other ones. You can click on Type & Label. The label is the more drawn-out explanation. That's one that you can include 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 give me a more drawn-out explanation of what this variable includes. We know this is going to be numeric. So click Continue. The next thing we're going to look at is this numeric expression box. And will 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'll 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. 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 on 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. And our expression sounds like 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 parentheses, 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 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 and 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 switch sides from pointing to the left to pointing to the right, click over 1, and we've already moved over item 1. 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 sumofitems, 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's this new column, this new variable, that sumofitems, 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, we'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'd be pretty easy to manually do this for 10 cases, but if you have a dataset that has 500 cases, that would be very time-consuming to do. And you could see that this function of computing this variable can save you a lot of time. It's also more accurate. It's going to take any 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 computer a variable. I'm going to show you 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 going to clear this out. We're done with someofitems, we don't need to worry about it, we're not going to use the same expression, so I'm going to 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're working with a pre-existing scale, it might tell you to 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 meanofitems. And again, that very quickly lets me differentiate between sumofitems and meanofitems. Type & label, and again, I'm just going to put mean of items 1 through 6, 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, 2, 3, 4, 5, and then 6. I'm making sure to not include this last one, this sumofitems. 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, meanofitems. 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 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 going to pick this one, for example, we've got 1, 1, 3, 3, 1, 2, and a mean of 1.83 would, just eyeballing it, 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 has computed the average score, the mean score for all six of those items. 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.