For the latest version of JMP Help, visit JMP.com/help.

Scripting Guide > Data Tables > Advanced Data Table Scripting > Create a Table of Summary Statistics
Publication date: 09/28/2021

Create a Table of Summary Statistics

The Summary command creates a new table of summary statistics according to the grouping columns that you specify. Do not confuse Summary with Summarize, which collects summary statistics for a data table and stores them in global variables. See Store Summary Statistics in Global Variables.

summDt = dt << Summary(
	Group( groupingColumns ),
	Subgroup( subGroupColumn ),
	Statistic( columns ),// where statistic is Mean, Min, Max, Std Dev, and so on.
	Output Table Name( newName ) );

The following example creates a new table with columns for the mean of height and weight by age, and the maximum height and minimum weight by age:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
summDt = dt << Summary(
	Group( :age ),
	Mean( :height, :weight ), Max( :height ), Min( :weight ),
	Output Table Name( "Height-Weight Chart" ) );

Tip: Output Table Name can take a quoted string or a variable that is a string.

By default, a summary table is linked to the original data table. If you want to produce a summary that is not linked to the original data table, add this option to your Summary message:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
summDt = dt << Summary( Group( :age ), Mean( :height ),
	Link to Original Data Table( 0 )
);

You can choose to add marginal statistics for grouping variables to the output columns of your data table. JMP also adds a row to the end of the data table that summarizes each level of the grouping variables. To add marginal statistics, add this option to your Summary message:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
summDt = dt << Summary( Group( :age ), Mean( :height ),
	Include marginal statistics
);

You can specify the format of the statistics column name using statistics column name format(). Table 9.2 shows the option and examples:

Table 9.2 Statistics Column Name Format Options and Examples

Option

Example

stat (column)

Mean (Profits ($M))

column

Profits ($M)

stat of column

Mean of Profits ($M)

column stat

Profits ($M) Mean

For example, add an option like this to your Summary message:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
summDt = dt << Summary( Group( :age ), Mean( :height ),
	statistics column name format( "stat of column" )
);

The height column is named Mean of height.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).