Summary Platform is what I generally use for this (how I use it depends on the use case: ties, do I need the count, how should missing values be handled and so on)
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt_summary = dt << Summary(
Group(:sex),
Freq("None"),
Weight("None"),
output table name("res"),
Private
);
// Using Loc Max
max_row = Loc Max(dt_summary[0, "N Rows"]);
max_val = dt_summary[max_row, 1];
show(max_val);
// Sorting
dt_summary << Sort(By(:N Rows), Replace Table, Order(Descending));
my_val = dt_summary[1, 1];
show(my_val);
Close(dt_summary, no save);
Also just using Mode function might be enough
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
val = Mode(dt[0, "sex"]);
And there are plenty of other options (like you can see in this thread already).
-Jarmo