Use call sort() to sort the teams per observation, and then proc summary to get the count:
data head_count;
input team1 $ team2 $;
datalines;
IND AUS
AUS IND
NZ IND
IND NZ
PAK IND
WI PAK
PAK AUS
;
data sorted;
set head_count;
call sort(of team:);
run;
proc summary data=sorted nway;
class team1 team2;
output out=want (drop=_type_ rename=(_freq_=count));
run;
Use call sort() to sort the teams per observation, and then proc summary to get the count:
data head_count;
input team1 $ team2 $;
datalines;
IND AUS
AUS IND
NZ IND
IND NZ
PAK IND
WI PAK
PAK AUS
;
data sorted;
set head_count;
call sort(of team:);
run;
proc summary data=sorted nway;
class team1 team2;
output out=want (drop=_type_ rename=(_freq_=count));
run;
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.