hi @FN ,
there must be many ways to get what you are asking for even though Mode is not an option in the table summary. You can ask for the Mode in the additional summary statistics table in the distribution platform manually or by clicking as @ian_jmp suggests. Otherwise, try using the add in by brady_brady :
Extended-Summary-Statistics-Add-in-for-JMP which refferes the mode from the menu.
alternatively, try the following script:
Names Default To Here( 1 );
// Open Data Table: Big Class.jmp
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// get frequencies for modes
dt2 = dt << Summary(
Group( :Age, :sex, :height ),
Link to original data table( 0 )
);
// delete all rows that are not modes
dt2 << select where( Or( :N Rows != Col Max( :N Rows, :age, :sex ), :N Rows == 1 ) );
dt2 << delete rows;
// indicate first and last values per group - Not min and max unless table is first sorted!!!
dt << New Column( "id age", Numeric, "Continuous", Format( "Best", 12 ), Formula( Sum( :age[Index( 1, Row() )] == :age ) ), eval formula, );
dt:id age << delete formula;
// remove all rows that are not first or last
dt << select where( And( :id age != Col Max( :id age, :age ), :id age != 1 ) );
dt << delete rows;
// create one table with all data and sort it
dt3 = dt << concatenate( dt2, Create source column );
dt3 << New Column( "Value",
Character,
"Ordinal",
Formula( If( :id age == 1, "First", :id age > 1, "Last", :N Rows > 1, "Mode" ) ),
Set Property( "Value Order", {Custom Order( {"First", "Mode", "Last"} ), Common Order( 0 )} ),
);
dt3 << sort( By( :age, :sex, :Value ), Order( Ascending ), replace table );
please notice that in the case of Big class, not all groups have a clear mode. my approach was to remove it the highest frequency was equal to 1.
please let us know if it works or what needs improvement.
Ron