该帮助的版本不再更新,请参见https://www.jmp.com/support/help/zh-cn/15.2 获取最新的版本.


The Summarize command collects summary statistics for a data table and stores them in global variables. The Summarize command is different from the Summary command, which also calculates summary statistics, but presents them in a new data table.
dt1 = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt2 = Open( "$SAMPLE_DATA/Animals.jmp" );
Summarize( dt1,
exg = By( :sex ),
exm = Mean( :height )
Show( exg );
Show( exm );
Named arguments include the following: Count, Sum, Mean, Min, Max, StdDev, First, Corr, and Quantile. These statistics can be calculated only for numeric columns. Each argument takes a data column argument.
注意: 
If a name=By(groupvar) statement is included, then a list of subgroup statistics is assigned to each name.
Count does not require a column argument, but it is often useful to specify a column to count the number of nonmissing values.
Quantile also takes a second argument for specifying which quantile, such as 0.1 for the 10th percentile.
注意:Excluded rows are excluded from Summarize calculations. If all data are excluded, Summarize returns lists of missing values. If all data have been deleted (there are no rows), Summarize returns empty lists.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
sumHt = Sum( :height ),
meanHt = Mean( :height ),
minHt = Min( :height ),
maxHt = Max( :height ),
sdHt = Std Dev( :height ),
q10Ht = Quantile( :height, .10 )
Show( a, c, sumHt, meanHt, minHt, maxHt, sdHt, q10Ht );
Because the script included a By group, the results are a list and six matrices:
New Window( "Summary Results",
Table Box(
String Col Box( "Age", a ),
Number Col Box( "Count", c ),
Number Col Box( "Sum", sumHt ),
Number Col Box( "Mean", meanHt ),
Number Col Box( "Min", minHt ),
Number Col Box( "Max", maxHt ),
Number Col Box( "SD", sdHt ),
Number Col Box( "Q10", q10Ht )
图 9.2 Results from Summarize
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
sumHt = Sum( :height ),
meanHt = Mean( :height ),
minHt = Min( :height ),
maxHt = Max( :height ),
sdHt = Std Dev( :height ),
q10Ht = Quantile( :height, .10 )
tsumHt = Sum( :height ),
tmeanHt = Mean( :height ),
tminHt = Min( :height ),
tmaxHt = Max( :height ),
tsdHt = Std Dev( :height ),
tq10Ht = Quantile( :height, .10 )
Insert Into( a, "Total" );
New Window( "Summary Results",
Table Box(
String Col Box( "Age", a ),
Number Col Box( "Count", c ),
Number Col Box( "Sum", sumHt ),
Number Col Box( "Mean", meanHt ),
Number Col Box( "Min", minHt ),
Number Col Box( "Max", maxHt ),
Number Col Box( "SD", sdHt ),
Number Col Box( "Q10", q10Ht )
图 9.3 Summarize with Total
If you do not specify a By group, the result in each name is a single value, as follows:
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
sumHt = Sum( :height ),
meanHt = Mean( :height ),
minHt = Min( :height ),
maxHt = Max( :height ),
sdHt = Std Dev( :height ),
q10Ht = Quantile( :height, .10 )
Show( c, sumHt, meanHt, minHt, maxHt, sdHt, q10Ht );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Summarize( g = By( :age, :sex ), c = Count() );
Show( g, c );