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


Scripting Guide > Data Tables > Advanced Data Table Scripting > Create a Table Using Tabulate
Publication date: 07/24/2024

Create a Table Using Tabulate

The Tabulate message constructs tables of descriptive statistics. The tables are built from grouping columns, analysis columns, and statistics keywords. The following example creates a table containing the standard deviation and mean for the height and weight of male and female students:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Tabulate( // message to data table
	Add Table( // start a new table
		Column Table( Grouping Columns( :sex ) ), // group using the column sex
		Row Table( // add rows to the table
 

// use the height and weight columns for the analysis

			Analysis Columns( :height, :weight ),
 

// show the standard deviation and mean

			Statistics( Std Dev, Mean )
		)
	)
);

You can apply a transformation to a column in the Tabulate table and set the format of the column at the same time. Use the Transform Column() function inside Analysis Column(). For example, the following script applies the Log transformation to height and sets the column format for the Mean and % of Total columns.

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Tabulate(
	Set Format(
		Mean(
			:height( 10, 1 ),
			Analysis Column(
				Transform Column(
					"Log[height]",
					Formula( Log( :height ) )
				),
				Format( 10, "Best" )
			)
		),
		"% of Total"n(:height( 12, 2 ),
		Analysis Column(
			Transform Column(
				"Log[height]",
				Formula( Log( :height ) )
			),
			Format( 12, 2 )
		))
	),
	Add Table(
		Column Table(
			Analysis Columns(
				:height,
				Transform Column(
					"Log[height]",
					Formula( Log( :height ) )
				)
			),
			Statistics( Mean, "% of Total"n )
		),
		Row Table( Grouping Columns( :sex ) )
	)
);

Note: You can also change the width of columns and perform additional operations within Tabulate. See the JMP Scripting Index in the Help menu.

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