Hi - the mode is the most common item, so you're after the person (or presumably persons if there's a tie) who received the most number of letters from each sender, is that right? If so, I think the following ought to do it, although I've no doubt there's a much more elegant and/or shorter way. I've deliberately left all the intermediate calculations, and named all the tables to leave an audit trail:
dt1 = open ("$SAMPLE_DATA/Mail Messages.jmp");
dt1 << set name("dt1");
dt2 = dt1 << Summary( Group( :From ), N, Subgroup( :To ) );
dt2 << set name("dt2");
Sent_From = (dt2 << get column names);
show(Sent_From);
// Throw away the first two elements of this list;
remove from(Sent_From, {1, 2});
show(Sent_From);
// Stack them up;
dt3 = dt2 << Stack(columns(eval(Sent_From)), Source Label Column( "Label" ), Stacked Data Column( "Data" ));
dt3 << set name("dt3");
// dt3 now contains the number of letters sent from each person to each recipient;
dt4 = dt3 << Summary( Group( :From ), Max( :Data ) );
dt4 << set name("dt4");
// dt4 now contains the maximum number of letters sent from each person to any one recipient;
dt5 = dt4 << Join( With( dt3 ),
SelectWith(:From, :Label, :Data ),
By Matching Columns( :From = :From, :Name( "Max(Data)" ) = :Data ),
Drop multiples( 0, 0 ),
Name("Include non-matches" )(0, 0),
Preserve main table order( 1 )
);
dt5 << set name("dt5");
column(dt5, "Label") << set name("Recipient");
/*
dt5 should now contain the maximum number of letters sent from each person to anyone recipient
and the name of that recipient (or recipients in the event of a tie)
*/
That should give you that Ann sent 4 letters to Michael, Jeff sent 7 letters to Michael, John sent 12 letters to Michael, Katherine sent 12 letters to John and so on. Would you like to try that out and see if it does what you need? To get the maximum number of letters received by any recipient from any one sender, just swap over the :To and :From columns.