Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
When you enter or import data into SPSS, you may want to know a person's average score on a series of variables, but it's usually a good idea to bring in the raw data and not a summarized version. That way you can recode or modify from the original information. Also some procedures, such as calculating something called the internal reliability of a questionnaire, those procedures may require the complete raw data. Once you bring the data in though and recode it as necessary, you can then compute the average scores, or a maximum, or spread, or whatever interests you, using SPSS's extremely flexible Compute command.
I am going to do this by using the GSS data set that asks people if whether in the last year they had seen a classical music or opera performance, or they had attended a live performance of pop music, or they had attended a dance performance in last year, seen a live drama, or even just read a novel or poem or a play in the last year, and then saw art. And so we have here a series of sort of cultural indicators, and one thing we might want to do is add up how many of these things people say they've done to get a rough index on cultural involvement.
One way to do this with Compute variable is to simply add these up, and I can do that even though it says the words yes and no here. If I come back up to the button Value Labels and click on it, you can see that I have zeros and ones underneath, and the nice thing about that, and this is why we prefer the indicator variables, is I can simply add them up. I can simply get a sum for these variables and find out how many of these people have done. I'm going to first create a space for this variable. Now you normally don't need to do this.
It would simply add the variable at end. But I'd like the variable to be right here next to the other ones, so what I am going to do is I'm going to come to the end of that list and now at Happy, I am going to right click on it and insert a new variable. And I am going to double-click on that variable to edit it. It will bring up Variable view, and click right here under Name, backspace, and I'll change name to ArtTotal. I can leave the width at 8.
I'll change the decimals to 0, because these are all integer values, and I'll add a label, Art Forms Participated. I'll also change this over here to a Scale variable, and I will change it to be both an Input and a Target variable, so I can use it either way by saying both. Come back to the Data view, and I'll save the data. And now what I am going to do is I am going to create a command that will add up these 1, 2, 3, 4, 5, 6 variables and create a score here, so it'll go from zero to six.
Go to Transform to Compute, and it asks me for the TargetVariable. Now I've already created it, so I can simply write here ArtTotal. And then it's going to ask for a numerical expression that's a formula. Now you can get very sophisticated formulas in SPSS. For instance, I can get an exponent, or I can do the modulus. In fact in a couple of videos from now, I am going to show you how to use the logarithmic function as a way of dealing with outliers.
But all I really want right now is a very, very simple one. All I need is the sum. I'll go to Function group. Then I come down here in the Functions and Special Variables list till I find Sum, and if double-click on that, it adds to the numeric expression and then asks, what is it that I'm going to be adding up? I can back up and remove those, and then I can select the variables that I want to be included in the sum. I want this variable, SawClassical, and I can add each one of these with a comma between them.
I can go like this, and I can add another one. But because these variables are sequential in the data file, I can actually use a shortcut expression. I can just list the first one, and then I can put space and write the word "to" and then the last one is "SawArt." And once I have that, it says to add up the scores on all these variables. Because they are 0/1 indicator variables, the sum will simply be how many of these did people say they've done in the last year. If I want to, I can make it so that it only calculates it for particular cases, for instance for just man or for people who are over particular age. I don't need to do that so I am going to leave it alone. I'll just press OK.
And it asks me if I want to change the existing variable. Now, there's nothing there because I created a blank variable, so I can just click OK. It writes down that it did COMPUTE, that the new variable ArtTotal is equal to the sum of SawClassical to SawArt, and then execute to actually create that. When I go to the data set, I see a new variable right here with scores from 0, there is a 5, I don't know if we have any 6s, I can check that out. But now I've created a new variable that combines the results of these various cultural indicators to give me a single variable that I can use in further analyses, a way of correlating with other variables and trying to get an idea of who might be more or less involved in arts and cultural activities.
And so the Compute command is a very flexible one, a great way of reforming the data to get it in the manner that can be most useful for your particular analyses.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 87469 Viewers
80 Video lessons · 136424 Viewers
59 Video lessons · 55084 Viewers
52 Video lessons · 68947 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.