This computes an adjacency matrix where the vertex on the graph of schools is the count of how many times a student enrolled into school X and school Y in the same year. From this you want to get a table listing vertices that have the largest "popularity-value" from each node/"school" in the graph.
proc sql;
create table want as
select Distinct
t1.school as school1,
t2.school as school2,
count(*) as count
from have t1, have t2
where t1.id=t2.id
and t1.year=t2.year
and t1.school > t2.school
group by t1.school,t2.school
;
quit;
data want;
set want want (rename=(school1=school2 school2=school1));
proc sort;
by school1 descending count;
proc sort nodupkey;
by school1 ;
run;
I once took this free EdX internet course on Excel and data analysis with Felienne Hermans from the Delft University of Technology, Netherlands. She taught her students, using data yanked from IMDB.com, to calculate an actor's Bacon number using similar math to this. It was fun.
... View more