Column statistics, such as mean for only selected rows.Hi.
I qould like to have a jsl command to find either column mean, median, or sigma for the height column, but only where age is only 12 and 13.
I tried select rows, but I dont seem to get the correct result. If i use or not use the select rows, it still gives me the same numbers.
Data Table( "table" ) << Select where( :age== { 12, 13 });
Sigma = Col Std Dev( As Column( "age" ) );
median = Col Mean( As Column( "age" ) );
show (Sigma);
show (median);
dt << Clear Select;
I appreciate any help in this.

Automation and ScriptingRe: Column statistics, such as mean for only selected rows.you asked for a JSL command - but maybe also interesting:
a very useful new feature in JMP 18: header statistics
they can be static - or (default setting) react on the row selection:

Via the preferences, the user can define which values are displayed.
It's amazing how many options are available.
I wish other platforms like Distribution, Tabulate, Summary, Summarize, and: Graph Builder (!)
had such a large selection of items to choose from.
here is the wish:
Col N Categories - and all the others ...
[what I miss the most: Col N Categories / N Unique in JSL and Graph Builder]


Re: Column statistics, such as mean for only selected rows.Here is the way I would handle this
Names Default To Here( 1 );
dt = Current Data Table();
sigma = Col Std Dev( If( :age == 12 | :age == 13, :Age, . ) );
Avg = Col Mean( If( :age == 12 | :age == 13, :Age, . ) );