how to combine rows of paired data into one row

#1
Hi,
I have data that is structured like the following:
location team score
away ny 100
home la 80
away chi 95
home det 85


But I would like to transform the pairs of data to be structured like this:
away_team home_team away_score home_score
ny la 100 80
chi det 95 85

Does anyone know how to do this? Thanks!
 
#2
Probably, you could do this easily in a data step..something like this
I have assumed that the data rows to be paired are in consecutive lines. Note that I have not tested this code.

Code:
data abc(keep=away_team home_team away_score home_score);
set abc;
retain away_team home_team away_score home_score;
if location="home" then do;
   home_team=team;
   home_score=score;
end;
else do;
   away_team=team;
   away_score=score;
end;
if mod(_n_,2)=0 then output;
run;