cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar

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. 

 

 

 

LogitElephant69_0-1731122458844.png

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

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, . ) );
Jim

View solution in original post

hogi
Level XIII

Re: 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:

hogi_1-1731138077296.png

 

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]

 

hogi_3-1731138564271.png

hogi_4-1731138578688.png

View solution in original post

2 REPLIES 2
txnelson
Super User

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, . ) );
Jim
hogi
Level XIII

Re: 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:

hogi_1-1731138077296.png

 

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]

 

hogi_3-1731138564271.png

hogi_4-1731138578688.png

Recommended Articles