Hello guys, I'm having an awful time trying to come up with how a particular code is to be written. Below is the basis of what I have now: View image: img1 When that code is run, it looks like this: View image: img2 As you can see, basically it's a layout of all 2014 world cup games (The image is cropped short, there are actually 64 observations). What I need to do within a DATA step is combine all distinct team observations (whether they be listed as Team1_Name or Team2_Name) and total their score in a new variable called 'GF'. For example, in image two 'Spain' is listed in observations 3 and 33. In observation 3, Spain scored 1 goal, in observation 33, Spain scored 3 goals. If those were the only two observations in which Spain appeared, it's output would look like: Team_Name, GF Spain, 4 Here is an image I put together using data lines to try and help imagine it (the observations are limited and the goal numbers made up): View image: img3 The code probably has to be some complicated combination of IF, THEN, DO, SELECT, WHERE... I have no idea, and I've been banging my head against the wall. Any suggestions would be greatly appreciated.
... View more