1 00:00:00,000 --> 00:00:03,060 >> So here we are in SPSS. 2 00:00:03,060 --> 00:00:04,900 I have created a junk data 3 00:00:04,900 --> 00:00:07,220 set just to help illustrate how we can 4 00:00:07,220 --> 00:00:08,840 compute variables or compute 5 00:00:08,840 --> 00:00:09,980 new variables using 6 00:00:09,980 --> 00:00:12,010 the values from existing ones. 7 00:00:12,010 --> 00:00:14,140 This is a pretty straightforward process. 8 00:00:14,140 --> 00:00:15,280 It looks a little bit 9 00:00:15,280 --> 00:00:16,680 different than things that we've done 10 00:00:16,680 --> 00:00:18,580 before or other ways that we're 11 00:00:18,580 --> 00:00:20,640 going to be using SPSS in this course. 12 00:00:20,640 --> 00:00:22,440 So it might look a little bit different, 13 00:00:22,440 --> 00:00:23,980 but it is pretty straightforward and 14 00:00:23,980 --> 00:00:26,375 pretty easy once you know how to do this. 15 00:00:26,375 --> 00:00:27,740 So the first thing that we'll 16 00:00:27,740 --> 00:00:29,345 do is go to Transform, 17 00:00:29,345 --> 00:00:30,680 and then the first option we 18 00:00:30,680 --> 00:00:32,120 have there is compute variable. 19 00:00:32,120 --> 00:00:34,440 So click on that. We get 20 00:00:34,440 --> 00:00:36,165 this new window that pops up. 21 00:00:36,165 --> 00:00:37,800 The first thing that we really want 22 00:00:37,800 --> 00:00:39,340 to look at is in the top left, 23 00:00:39,340 --> 00:00:42,580 and that's this target variable window. 24 00:00:42,580 --> 00:00:44,130 Basically what the computer 25 00:00:44,130 --> 00:00:45,610 is asking you is to create 26 00:00:45,610 --> 00:00:47,630 a name for the new variable 27 00:00:47,630 --> 00:00:49,070 that you're going to be computing. 28 00:00:49,070 --> 00:00:50,860 This name needs to be unique, 29 00:00:50,860 --> 00:00:53,170 it's one that can't have spaces in it, 30 00:00:53,170 --> 00:00:55,315 and it should avoid special characters. 31 00:00:55,315 --> 00:00:56,710 But, in this case, 32 00:00:56,710 --> 00:00:58,630 what I like to do is include 33 00:00:58,630 --> 00:01:01,330 some piece of information in there 34 00:01:01,330 --> 00:01:03,550 in the naming convention I use that 35 00:01:03,550 --> 00:01:04,810 helps me know what this is 36 00:01:04,810 --> 00:01:06,250 just by looking at it. 37 00:01:06,250 --> 00:01:07,890 So what we're going to be doing is 38 00:01:07,890 --> 00:01:09,650 we're going to be summing items 1, 39 00:01:09,650 --> 00:01:10,970 2, 3, 4, 5, 40 00:01:10,970 --> 00:01:12,740 and 6 together, adding those together. 41 00:01:12,740 --> 00:01:14,330 So an easy way to do that is 42 00:01:14,330 --> 00:01:17,480 just to put sumofitems. 43 00:01:17,480 --> 00:01:20,040 That way, when I look at 44 00:01:20,040 --> 00:01:21,850 this new variable once it's generated, 45 00:01:21,850 --> 00:01:23,350 I know that that's the variable 46 00:01:23,350 --> 00:01:24,930 that I really want to be working 47 00:01:24,930 --> 00:01:26,720 with or running my tests on 48 00:01:26,720 --> 00:01:28,030 because that contains 49 00:01:28,030 --> 00:01:29,865 the information from the other ones. 50 00:01:29,865 --> 00:01:32,970 You can click on Type & Label. 51 00:01:32,970 --> 00:01:36,390 The label is the more drawn-out explanation. 52 00:01:36,390 --> 00:01:37,870 That's one that you can include 53 00:01:37,870 --> 00:01:39,390 additional characters or 54 00:01:39,390 --> 00:01:41,070 spaces and special characters. 55 00:01:41,070 --> 00:01:43,150 In our case, I'm going to put this is 56 00:01:43,150 --> 00:01:48,975 the sum of items 1 through 6. 57 00:01:48,975 --> 00:01:50,790 And that way I know that 58 00:01:50,790 --> 00:01:52,550 that is going to give me 59 00:01:52,550 --> 00:01:55,150 a more drawn-out explanation 60 00:01:55,150 --> 00:01:57,010 of what this variable includes. 61 00:01:57,010 --> 00:01:59,325 We know this is going to be numeric. 62 00:01:59,325 --> 00:02:01,175 So click Continue. 63 00:02:01,175 --> 00:02:03,110 The next thing we're going to look at 64 00:02:03,110 --> 00:02:05,045 is this numeric expression box. 65 00:02:05,045 --> 00:02:06,530 And will actually come back 66 00:02:06,530 --> 00:02:07,730 to this in just a minute, 67 00:02:07,730 --> 00:02:08,390 but this is where you're 68 00:02:08,390 --> 00:02:09,330 going to be doing most 69 00:02:09,330 --> 00:02:11,390 of the work when you're computing a variable. 70 00:02:11,390 --> 00:02:13,190 What you'll want to go to next 71 00:02:13,190 --> 00:02:14,880 is this function group area. 72 00:02:14,880 --> 00:02:16,665 So I'm going to click on All. 73 00:02:16,665 --> 00:02:18,630 And you notice right below it we've 74 00:02:18,630 --> 00:02:20,580 got these functions and special variables, 75 00:02:20,580 --> 00:02:22,815 and this popped up when I clicked on All. 76 00:02:22,815 --> 00:02:24,550 This has a whole bunch of 77 00:02:24,550 --> 00:02:26,200 different pre-existing functions, 78 00:02:26,200 --> 00:02:27,640 so you don't need to reinvent the wheel, 79 00:02:27,640 --> 00:02:28,870 you can basically use 80 00:02:28,870 --> 00:02:30,950 these pre-existing functions to 81 00:02:30,950 --> 00:02:33,135 help you compute this new variable. 82 00:02:33,135 --> 00:02:34,710 I'm going to go down to sum, 83 00:02:34,710 --> 00:02:36,250 and these are in alphabetical order, 84 00:02:36,250 --> 00:02:37,890 so it's pretty easy to find. 85 00:02:37,890 --> 00:02:40,180 Here we have sum, and when I click on sum, 86 00:02:40,180 --> 00:02:41,490 you'll notice that this box on 87 00:02:41,490 --> 00:02:43,955 the left populated with some text. 88 00:02:43,955 --> 00:02:46,005 This box is actually pretty useful. 89 00:02:46,005 --> 00:02:47,650 So the first thing it shows you is 90 00:02:47,650 --> 00:02:48,570 an example of what 91 00:02:48,570 --> 00:02:50,210 this expression is going to be. 92 00:02:50,210 --> 00:02:51,540 And our expression sounds like 93 00:02:51,540 --> 00:02:52,635 a really fancy term. 94 00:02:52,635 --> 00:02:54,050 If you've ever used a formula 95 00:02:54,050 --> 00:02:55,670 in Excel, it's basically that. 96 00:02:55,670 --> 00:02:56,990 It's telling the computer 97 00:02:56,990 --> 00:02:58,465 what it needs to do. 98 00:02:58,465 --> 00:03:00,750 In this case, just like Excel, 99 00:03:00,750 --> 00:03:02,030 we've got the word sum, 100 00:03:02,030 --> 00:03:03,570 which tells the computer it's going to be 101 00:03:03,570 --> 00:03:05,365 summing different values together, 102 00:03:05,365 --> 00:03:06,630 and then in parentheses, 103 00:03:06,630 --> 00:03:07,570 immediately after that, 104 00:03:07,570 --> 00:03:09,070 we have different variables 105 00:03:09,070 --> 00:03:10,705 that are separated by a comma, 106 00:03:10,705 --> 00:03:11,930 and that's what tells the 107 00:03:11,930 --> 00:03:13,390 computer to add x, y, 108 00:03:13,390 --> 00:03:15,150 and z things together to create 109 00:03:15,150 --> 00:03:17,800 a new variable or compute a new variable. 110 00:03:17,800 --> 00:03:18,870 This also provides 111 00:03:18,870 --> 00:03:20,750 additional extra content here, 112 00:03:20,750 --> 00:03:22,190 but we don't need to worry about that. 113 00:03:22,190 --> 00:03:23,930 I found this is helpful if you 114 00:03:23,930 --> 00:03:26,000 are stuck or something isn't working right. 115 00:03:26,000 --> 00:03:27,930 So we've got sum selected, 116 00:03:27,930 --> 00:03:29,780 we're going to be summing the items of 1, 117 00:03:29,780 --> 00:03:31,760 2, 3, 4, 5, and 6 together. 118 00:03:31,760 --> 00:03:33,055 We've got that selected. 119 00:03:33,055 --> 00:03:34,110 So the next thing you do 120 00:03:34,110 --> 00:03:35,190 is click this up arrow, 121 00:03:35,190 --> 00:03:36,270 which basically takes 122 00:03:36,270 --> 00:03:38,030 that pre-existing function 123 00:03:38,030 --> 00:03:39,720 and it kicks it up to this numeric 124 00:03:39,720 --> 00:03:41,550 and expression box. 125 00:03:41,550 --> 00:03:43,870 The next thing that we're going to do, 126 00:03:43,870 --> 00:03:44,710 we've already told 127 00:03:44,710 --> 00:03:45,810 the computer that we're going 128 00:03:45,810 --> 00:03:47,740 to sum different variables together, 129 00:03:47,740 --> 00:03:48,910 we need to tell it which 130 00:03:48,910 --> 00:03:50,480 variables to sum together. 131 00:03:50,480 --> 00:03:52,790 So the easy way to do this is to 132 00:03:52,790 --> 00:03:54,110 click on the first 133 00:03:54,110 --> 00:03:55,445 item that you want to include, 134 00:03:55,445 --> 00:03:57,850 and you'll notice that this arrow 135 00:03:57,850 --> 00:03:59,290 switch sides from pointing 136 00:03:59,290 --> 00:04:00,785 to the left to pointing to the right, 137 00:04:00,785 --> 00:04:02,060 click over 1, 138 00:04:02,060 --> 00:04:04,350 and we've already moved over item 1. 139 00:04:04,350 --> 00:04:07,020 What you need to be careful of is that you 140 00:04:07,020 --> 00:04:09,640 always have a comma after each variable, 141 00:04:09,640 --> 00:04:11,085 except for the last one. 142 00:04:11,085 --> 00:04:12,600 So a comma is already here, 143 00:04:12,600 --> 00:04:14,815 but what I usually do is I just hit a comma, 144 00:04:14,815 --> 00:04:16,675 I go to item 2, 145 00:04:16,675 --> 00:04:19,010 kick that over, comma, 146 00:04:19,010 --> 00:04:21,030 item 3, kick that over, 147 00:04:21,030 --> 00:04:23,550 comma, item 4, kick that over, 148 00:04:23,550 --> 00:04:25,260 comma, item 5, 149 00:04:25,260 --> 00:04:26,880 kick that over, comma, 150 00:04:26,880 --> 00:04:28,935 item 6, kick that over. 151 00:04:28,935 --> 00:04:30,420 Now, we know that item 6 152 00:04:30,420 --> 00:04:31,920 is the last one we have, 153 00:04:31,920 --> 00:04:33,690 the last variable we're including, 154 00:04:33,690 --> 00:04:35,100 so what we're going to do is 155 00:04:35,100 --> 00:04:36,700 just delete out that question mark, 156 00:04:36,700 --> 00:04:38,515 we're going to delete out that last comma, 157 00:04:38,515 --> 00:04:40,260 and then if we read through this real quick 158 00:04:40,260 --> 00:04:40,980 just to make sure we 159 00:04:40,980 --> 00:04:42,190 don't have any problems, 160 00:04:42,190 --> 00:04:45,095 we've got creating sumofitems, 161 00:04:45,095 --> 00:04:46,880 this is going to be the sum of 162 00:04:46,880 --> 00:04:48,435 item 1, 2, 3, 163 00:04:48,435 --> 00:04:51,280 4, 5, and 6, 164 00:04:51,280 --> 00:04:54,095 and what we're going to do now is click OK. 165 00:04:54,095 --> 00:04:56,620 An output window pops 166 00:04:56,620 --> 00:04:57,720 up and it basically tells 167 00:04:57,720 --> 00:04:58,860 you what the computer did. 168 00:04:58,860 --> 00:05:00,500 It computed the sum of items, 169 00:05:00,500 --> 00:05:01,830 which was the sum of item 1, 170 00:05:01,830 --> 00:05:03,315 2, 3, 4, 5, and 6, 171 00:05:03,315 --> 00:05:05,110 it gives us the variable label, 172 00:05:05,110 --> 00:05:08,620 it gives us that descriptive text I put in. 173 00:05:08,620 --> 00:05:10,080 I'm just going to minimize this window, 174 00:05:10,080 --> 00:05:11,280 and if we look back here, 175 00:05:11,280 --> 00:05:12,200 you might notice that 176 00:05:12,200 --> 00:05:13,620 there's this new column, 177 00:05:13,620 --> 00:05:15,510 this new variable, that sumofitems, 178 00:05:15,510 --> 00:05:16,935 that wasn't there when we started, 179 00:05:16,935 --> 00:05:19,155 and that's because SPSS computed that. 180 00:05:19,155 --> 00:05:20,780 And if we add these together, 181 00:05:20,780 --> 00:05:22,235 if you add each row, 182 00:05:22,235 --> 00:05:24,320 we've got 1, 2, 1, 3, 5, 183 00:05:24,320 --> 00:05:26,565 1, that adds to 13, 184 00:05:26,565 --> 00:05:28,005 5, 1, 2, 185 00:05:28,005 --> 00:05:29,940 3, 5, 1 adds to 17. 186 00:05:29,940 --> 00:05:31,540 So it's done that math for us. 187 00:05:31,540 --> 00:05:33,425 We didn't have to manually do it. 188 00:05:33,425 --> 00:05:35,720 I know, yes, it'd be pretty easy to 189 00:05:35,720 --> 00:05:38,280 manually do this for 10 cases, 190 00:05:38,280 --> 00:05:41,060 but if you have a dataset that has 500 cases, 191 00:05:41,060 --> 00:05:43,000 that would be very time-consuming to do. 192 00:05:43,000 --> 00:05:45,460 And you could see that this function of 193 00:05:45,460 --> 00:05:47,360 computing this variable can 194 00:05:47,360 --> 00:05:48,460 save you a lot of time. 195 00:05:48,460 --> 00:05:49,820 It's also more accurate. 196 00:05:49,820 --> 00:05:51,385 It's going to take any error 197 00:05:51,385 --> 00:05:53,790 out of the equation. 198 00:05:53,790 --> 00:05:54,940 And we know that often 199 00:05:54,940 --> 00:05:56,120 when we do things by hand, 200 00:05:56,120 --> 00:05:57,900 we can introduce error into things, 201 00:05:57,900 --> 00:05:59,550 so we want to avoid that. 202 00:05:59,550 --> 00:06:01,845 That's one way to computer a variable. 203 00:06:01,845 --> 00:06:04,760 I'm going to show you a different type 204 00:06:04,760 --> 00:06:06,160 of variable that we can compute. 205 00:06:06,160 --> 00:06:07,845 I'm going to go back to Transform, 206 00:06:07,845 --> 00:06:09,570 I'm going to go back to Compute Variable. 207 00:06:09,570 --> 00:06:11,420 I'm actually going to clear this out. 208 00:06:11,420 --> 00:06:12,860 We're done with someofitems, 209 00:06:12,860 --> 00:06:13,840 we don't need to worry about it, 210 00:06:13,840 --> 00:06:15,280 we're not going to use the same expression, 211 00:06:15,280 --> 00:06:16,140 so I'm going to click 212 00:06:16,140 --> 00:06:17,835 Reset in the bottom here. 213 00:06:17,835 --> 00:06:20,240 So what I want to do is create 214 00:06:20,240 --> 00:06:22,540 the mean of the different items that we have. 215 00:06:22,540 --> 00:06:24,000 Sometimes if you're working 216 00:06:24,000 --> 00:06:26,100 with a pre-existing scale, 217 00:06:26,100 --> 00:06:28,320 it might tell you to add 218 00:06:28,320 --> 00:06:29,740 all the items together and then 219 00:06:29,740 --> 00:06:31,340 that's what represents 220 00:06:31,340 --> 00:06:34,225 that theoretical concept or that measure, 221 00:06:34,225 --> 00:06:36,380 sometimes it might tell you to use the mean. 222 00:06:36,380 --> 00:06:38,600 So what I want to do is compute both of 223 00:06:38,600 --> 00:06:39,720 these things because they 224 00:06:39,720 --> 00:06:41,295 both might be helpful to me. 225 00:06:41,295 --> 00:06:42,860 So what I'm going to do is 226 00:06:42,860 --> 00:06:44,990 I'm going to type meanofitems. 227 00:06:44,990 --> 00:06:47,240 And again, that very quickly lets me 228 00:06:47,240 --> 00:06:48,230 differentiate between 229 00:06:48,230 --> 00:06:49,970 sumofitems and meanofitems. 230 00:06:49,970 --> 00:06:51,700 Type & label, and again, 231 00:06:51,700 --> 00:06:54,720 I'm just going to put mean of items 1 through 232 00:06:54,720 --> 00:07:01,905 6, click Continue. 233 00:07:01,905 --> 00:07:04,900 Just like we did before, click on All, 234 00:07:04,900 --> 00:07:06,380 and then we're going to go down 235 00:07:06,380 --> 00:07:10,335 to mean, here's mean. 236 00:07:10,335 --> 00:07:11,790 And when I click on that, again, 237 00:07:11,790 --> 00:07:14,090 it gives me that sample text here. 238 00:07:14,090 --> 00:07:16,975 This is very similar to what we did before. 239 00:07:16,975 --> 00:07:19,330 I'm going to click up, and 240 00:07:19,330 --> 00:07:21,505 we're going to kick over 1, 241 00:07:21,505 --> 00:07:29,610 2, 3, 4, 5, and then 6. 242 00:07:29,610 --> 00:07:31,070 I'm making sure to not 243 00:07:31,070 --> 00:07:33,835 include this last one, this sumofitems. 244 00:07:33,835 --> 00:07:35,250 And then just like last time, 245 00:07:35,250 --> 00:07:36,150 we're going to delete out 246 00:07:36,150 --> 00:07:37,280 that question mark, that last comma. 247 00:07:37,280 --> 00:07:38,790 We're going to read through 248 00:07:38,790 --> 00:07:40,505 it really quickly just to avoid an error. 249 00:07:40,505 --> 00:07:42,820 We've got a new variable, meanofitems. 250 00:07:42,820 --> 00:07:44,835 It's going to be the mean of item 1, 251 00:07:44,835 --> 00:07:47,265 2, 3, 4, 5, and 6. 252 00:07:47,265 --> 00:07:51,130 I'm going to click OK. SPSS 253 00:07:51,130 --> 00:07:53,895 again showed me the syntax of what it did. 254 00:07:53,895 --> 00:07:55,695 I'm going to minimize that. 255 00:07:55,695 --> 00:07:58,080 And then here we have the mean of items. 256 00:07:58,080 --> 00:08:00,010 And if we really quickly look at this, 257 00:08:00,010 --> 00:08:01,990 I'm going to pick this one, for example, 258 00:08:01,990 --> 00:08:03,700 we've got 1, 259 00:08:03,700 --> 00:08:06,110 1, 3, 3, 1, 2, 260 00:08:06,110 --> 00:08:07,710 and a mean of 1.83 would, 261 00:08:07,710 --> 00:08:09,975 just eyeballing it, make sense. 262 00:08:09,975 --> 00:08:11,580 If we look at this one, 263 00:08:11,580 --> 00:08:13,590 3.67, 2, 264 00:08:13,590 --> 00:08:15,645 3, 5, 4, 5, 3, 265 00:08:15,645 --> 00:08:16,990 that would roughly make sense 266 00:08:16,990 --> 00:08:18,650 without having to do the math of it, 267 00:08:18,650 --> 00:08:21,310 but this has computed the average score, 268 00:08:21,310 --> 00:08:24,450 the mean score for all six of those items. 269 00:08:24,450 --> 00:08:26,590 So that is very quickly how to 270 00:08:26,590 --> 00:08:28,810 compute a new variable in SPSS. 271 00:08:28,810 --> 00:08:30,410 This is particularly useful 272 00:08:30,410 --> 00:08:32,190 when you have collected data using 273 00:08:32,190 --> 00:08:34,610 a pre-existing measure and that measure has 274 00:08:34,610 --> 00:08:36,310 instructed you to compute 275 00:08:36,310 --> 00:08:38,510 the sum of items and run your tests on that, 276 00:08:38,510 --> 00:08:39,930 or maybe the mean of items 277 00:08:39,930 --> 00:08:41,450 and run your tests on that. 278 00:08:41,450 --> 00:08:43,130 But this is a useful way 279 00:08:43,130 --> 00:08:44,450 of understanding how to create 280 00:08:44,450 --> 00:08:48,190 new variables using existing ones in SPSS.