The answer may depend on what happens next. You can certainly do:
NamesDefaultToHere(1);
// (1) Get some data
dt1 = Open("$SAMPLE_DATA/Big Class.jmp");
// (2) Get summary info into a list and a vector
Summarize(groups = By(:sex), groupMeans = Mean(:height));
// (3) Make a table using the summary info
dt2 = NewTable("Height by Gender",
NewColumn("Gender", Character, Nominal, Values(groups)),
NewColumn("Mean Height", Numeric, Continuos, Values(groupMeans))
);
(see the JSL Scripting Guide for more options with Summarise).
If you need step 3, you may be better using either 'Tables > Summary' or 'Analyse > Tabulate'.
You can also aggregate across any set of rows, so long as you can express what that selection is.