Tabulate
Example 1
Summary: Generates a tabulate summary of premium and claim USD data, grouped by branch and zone, with statistics for each column.
Code:
// Tabulate (Summary)
// Open data table
dt = Open("data_table.jmp");
// Tabulate (Summary)
Tabulate(
Set Format(
Sum(
Premium USD( 15, 95 ),
Claim USD( 15, 95 )
)
),
Add Table(
Column Table(
Analysis Columns(
:Premium USD
),
Statistics( N, Sum )
),
Column Table(
Analysis Columns(
:Claim USD
),
Statistics( N, Sum )
),
Row Table(
Grouping Columns(
:Branch, :Zone
)
)
)
);
Code Explanation:
- Open table.
- Create tabulate summary.
- Set format for summary.
- Add premium USD column table.
- Include premium USD statistics.
- Add claim USD column table.
- Include claim USD statistics.
- Add row table.
- Set grouping columns.
- Display tabulate summary.
Example 2
Summary: Opens a data table, creates a tabulation with a column table and row table, and calculates the mean of the 'Baseline' column for each group in the 'Testers' column.
Code:
// Tabulate
// Open data table
dt = Open("data_table.jmp");
// Tabulate
Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table(
Analysis Columns( :Baseline ),
Statistics( Mean )
),
Row Table(
Grouping Columns( :Testers )
)
)
);
Code Explanation:
- Open data table.
- Create tabulation.
- Hide control panel.
- Add column table.
- Select baseline column.
- Calculate mean statistic.
- Add row table.
- Group by testers.
Example 3
Summary: Generates a tabulate report with mean and standard deviation statistics for the 'X' and 'Y' columns, grouped by 'Ship event' and 'Lot'.
Code:
// Tabulate
// Open data table
dt = Open("data_table.jmp");
// Tabulate
Tabulate(
Add Table(
Column Table(
Analysis Columns( :X, :Y ),
Statistics( Mean, Std Dev )
),
Row Table(
Grouping Columns(
:Ship event, :Lot
)
)
)
);
Code Explanation:
- Open data table.
- Create tabulate report.
- Add table to report.
- Define column table.
- Specify analysis columns.
- Choose statistics: mean, standard deviation.
- Define row table.
- Set grouping columns.
- Group by ship event.
- Group by lot.
Example 4
Summary: Opens a data table, hides the control panel, and creates a tabulate object with two row tables grouped by 'surface quality' and 'color'.
Code:
// Tabulate 2
// Open data table
dt = Open("data_table.jmp");
// Tabulate 2
Tabulate(
Show Control Panel( 0 ),
Add Table(
Row Table(
Grouping Columns(
:surface quality
)
),
Row Table(
Grouping Columns( :color )
)
)
);
Code Explanation:
- Open data table.
- Create tabulate object.
- Hide control panel.
- Add first row table.
- Set grouping column.
- Add second row table.
- Set grouping column.
Example 5
Summary: Opens a data table, creates a tabulate report with grouping columns for color and surface quality, and hides the control panel.
Code:
// Tabulate 3
// Open data table
dt = Open("data_table.jmp");
// Tabulate 3
Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table(
Grouping Columns( :color )
),
Row Table(
Grouping Columns(
:surface quality
)
)
)
);
Code Explanation:
- Open data table.
- Create tabulate report.
- Hide control panel.
- Add column table.
- Set grouping column to color.
- Add row table.
- Set grouping column to surface quality.
Example 6
Summary: Creates a tabulate object to visualize and analyze body mass, flipper length, and species data, with interactive features for grouping by sex and species.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", Invisible );
obj = dt << Tabulate(
Show Chart( 1 ),
Uniform plot scale( 0 ),
Add Table(
Column Table( Analysis Columns( :Body Mass ), Grouping Columns( :Sex ) ),
Column Table( Analysis Columns( :Flipper Length ), Statistics( Mean ) ),
Row Table( Grouping Columns( :Species ) )
)
);
rpt = Report( obj );
Code Explanation:
- Open data table;
- Create tabulate object.
- Show chart in tabulate.
- Set uniform plot scale.
- Add column table for body mass.
- Group body mass by sex.
- Add column table for flipper length.
- Calculate mean of flipper length.
- Add row table for species.
- Group species in row table.
Example 7
Summary: Creates a tabulation object with column and row grouping, displaying the results in a journal window.
Code:
dt = Open("data_table.jmp");
dt << select where( :size == "Large" );
obj = dt << Tabulate(
Show Control Panel( 0 ),
Add Table( Column Table( Grouping Columns( :sex, :marital status ) ), Row Table( Grouping Columns( :country, :size ) ) )
);
obj << journal window();
Code Explanation:
- Open data table.
- Select rows where size is Large.
- Create tabulation object.
- Hide control panel.
- Add column table with sex and marital status.
- Add row table with country and size.
- Display tabulation in journal window.
Example 8
Summary: Creates a tabulate object with grouped columns and rows, displaying the results in a journal window.
Code:
Names Default To Here( 1 );
dt = Open("data_table.jmp");
dt << select where( :size == "Large" );
obj = dt << Tabulate(
Show Control Panel( 0 ),
Add Table( Column Table( Grouping Columns( :sex, :marital status ) ), Row Table( Grouping Columns( :country, :size ) ) )
);
obj << journal window();
dt << close window();
Code Explanation:
- Set default names.
- Open data table.
- Select rows where size is "Large".
- Create tabulate object.
- Hide control panel.
- Add column table with sex and marital status.
- Add row table with country and size.
- Display tabulate in journal window.
- Close data table window.
Example 9
Summary: Creates a tabulation object with customized item labels, column and row tables, and a report title, based on grouping columns and analysis columns.
Code:
dt = Open("data_table.jmp");
Tab2 = dt << Tabulate(
Order by count of grouping columns,
Change Item Label( Statistics( "% of Total"n, "% of Age" ) ),
Remove Column Label( Grouping Columns( :sex, :marital status ), Analysis Columns( age ) ),
Order By Count( Grouping Columns( :sex, :size ), 0 ),
Show Control Panel( 0 ),
Add Table(
Column Table( Grouping Columns( :sex, :marital status ), Analysis Columns( :age ), Statistics( "% of Total"n ) ),
Row Table( Grouping Columns( :country, :size ) )
),
SendToReport(
Dispatch( {}, "Tabulate", OutlineBox, {Set Title( "Tabulate - order by count for grouping cols, NOT :size and :sex" )} )
)
);
Code Explanation:
- Open data table;
- Create tabulation object.
- Order by count of groups.
- Change item label to percentages.
- Remove column labels for specific columns.
- Order by count for selected groups.
- Hide control panel.
- Add column table with statistics.
- Add row table with grouping.
- Set report title.
Example 10
Summary: Creates a tabulated data visualization to analyze age distribution by type, country, size, and sex, utilizing the Tabulate function in JMP.
Code:
dt under test = Open("data_table.jmp");
obj = Tabulate(
Show Control Panel( 0 ),
Set Format( N( 9, -1 ) ),
Add Table(
Column Table( Analysis Columns( :age ), Statistics( Mean, Std Dev ) ),
Column Table( Grouping Columns( :type ) ),
Row Table( Grouping Columns( :country, :size ) ),
Row Table( Grouping Columns( :sex ) )
)
);
Code Explanation:
- Open data_table data
- Create tabulate object.
- Hide control panel.
- Set number format.
- Add column table.
- Analyze age: mean, std dev.
- Group by type.
- Add row table.
- Group by country, size.
- Add row table. Group by sex.
Example 11
Summary: Creates a tabulated report with summary statistics for 'age' by 'country', utilizing Column Table and Row Table features in JMP.
Code:
dt = Open( "data_table.jmp", "invisible" );
dt << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table(
Analysis Columns( :age ),
Statistics( Range, Sum, Min, Max ),
Pack( Statistics( Min, Max ) ),
Pack( Statistics( Range, Sum ) )
),
Row Table( Grouping Columns( :country ) )
)
);
Code Explanation:
- Open data table.
- Hide the control panel.
- Add a table.
- Define column table.
- Set analysis columns.
- Choose statistics: Range, Sum, Min, Max.
- Pack Min and Max statistics.
- Pack Range and Sum statistics.
- Define row table.
- Set grouping columns.
Example 12
Summary: Creates a tabulated data visualization to summarize engine size and maximum horsepower for each manufacturer and model, utilizing the Tabulate platform in JMP.
Code:
dt = Open("data_table.jmp");
tab = dt << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table(
Statistics( Sum ),
Analysis Columns( :"Engine Size (liters)"n, :Maximum Horsepower ),
Pack( Analysis Columns( "Engine Size (liters)"n, Maximum Horsepower ) )
),
Row Table( Grouping Columns( :Manufacturer, :Model ), Stack Grouping Columns( 1 ) )
)
);
Code Explanation:
- Open data table.
- Create tabulate object.
- Hide control panel.
- Add column table.
- Set statistics to sum.
- Select analysis columns.
- Pack analysis columns.
- Add row table.
- Group by manufacturer and model.
- Stack grouping columns.
Example 13
Summary: Creates a tabulated report with analysis columns for OZONE, CO, SO2, NO, and PM10, using the Tabulate platform in JMP.
Code:
dt = Open( "data_table.jmp", "private" );
tab = dt << Tabulate(
Page Column( :State( "NC" ) ),
Show Control Panel( 0 ),
Add Table( Column Table( Analysis Columns( :OZONE, :CO, :SO2, :NO, :PM10 ) ) )
);
Code Explanation:
- Open table.
- Create tabulate object.
- Set page column to NC.
- Hide control panel.
- Add table to tabulate.
- Specify analysis columns.
- Include OZONE column.
- Include CO column.
- Include SO2 column.
- Include NO column.
- Include PM10 column.
Example 14
Summary: Creates two tabulations in JMP, one for NC state and another for age 15, with specific column and row settings.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
tab = dt << Tabulate(
Page Column( :State( "NC" ) ),
Show Control Panel( 0 ),
Add Table( Column Table( Analysis Columns( :OZONE, :CO, :SO2, :NO, :PM10 ) ) )
);
dt = Open( "$SAMPLE_DATA/data_table2.jmp", "private" );
tab2 = dt << Tabulate(
Page Column( :age( 15 ) ),
Show Control Panel( 0 ),
Set Format( Name( "% of Total" )(9, 2) ),
Add Table(
Column Table( Analysis Columns( :height, :weight ) ),
Column Table( Statistics( Name( "% of Total" ) ) ),
Row Table( Grouping Columns( :sex ) )
)
);
Code Explanation:
- Open data table;
- Create tabulation for NC state.
- Hide control panel.
- Add analysis columns: OZONE, CO, SO2, NO, PM10.
- Open data table;
- Create tabulation for age 15.
- Hide control panel.
- Set percentage format to 9, 2.
- Add height and weight analysis columns.
- Add percentage of total statistics.
Example 15
Summary: Creates a tabulation page with filtered data, hiding control panels and adding column tables for analysis.
Code:
dt = Open( "$data_table.jmp", "private" );
tab = dt << Tabulate(
Page Column( :State( "NC" ) ),
Show Control Panel( 0 ),
Add Table( Column Table( Analysis Columns( :OZONE, :CO, :SO2, :NO, :PM10 ) ) )
);
dt = Open( "data_table2.jmp", "private" );
Code Explanation:
- Open data table;
- Create tabulation page.
- Filter State as NC.
- Hide control panel.
- Add column table analysis.
- Include OZONE, CO, SO2, NO, PM10 columns.
- Open data table;
Example 16
Summary: Creates a tabulate report with grouped columns and analysis, utilizing the Add Table and SendToReport functions in JMP.
Code:
dt under test = Open("data_table.jmp");
obj = Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Grouping Columns( :sex ) ),
Row Table( Grouping Columns( :age ), Analysis Columns( :height, :weight ), Statistics( Row % ) )
),
SendToReport(
Dispatch( {}, "Tabulate", OutlineBox, {Set Title( "Tabulate - look for columns clearly separated & rows alternating colors" )} )
)
);
Code Explanation:
- Open data table.
- Create tabulate object.
- Hide control panel.
- Add column table with grouping.
- Add row table with grouping and analysis.
- Set statistics to row percentage.
- Send report to display.
- Dispatch report settings.
- Set title for tabulate.
- Customize report appearance.
Example 17
Summary: Creates a tabulated data visualization with frequency distributions and weighted statistics for grouped columns, utilizing JMP's Tabulate platform.
Code:
dt = Open( "data_table.jmp", "Invisible" );
tab = dt << Tabulate( Add Table( Column Table( Grouping Columns( :age ) ) ) );
tab << Freq( :height );
tab << Freq();
tab << Weight( :height );
tab << ID( :Sex );
tab << Weight();
Code Explanation:
- Open data table;
- Create tabulate object.
- Set age as grouping column.
- Add height frequency.
- Add default frequency.
- Set height as weight column.
- Set Sex as ID column.
- Add default weight.
Example 18
Summary: Creates a tabulation table with frequency analysis and grouping by age, utilizing JMP's Tabulate platform.
Code:
dt = Open( "data_table.jmp", "Invisible" );
tab = dt << Tabulate( Add Table( Column Table( Grouping Columns( :age ) ) ) );
tab << Freq( :height );
tab << Freq();
tab << Weight( :height );
tab << ID( :Sex );
tab << Weight();
tab << ID();
Code Explanation:
- Open data_table data
- Create tabulation table.
- Group by age.
- Add height frequency.
- Add overall frequency.
- Set height as weight.
- Add sex as identifier.
- Set weight to default.
- Add identifier to default.
- Display tabulation.
Example 19
Summary: Runs the tabulation process to display a summary of Premium USD and Claim USD by Branch and Zone, utilizing Column Tables with Statistics for count and sum.
Code:
Open("data_table.jmp");
Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Analysis Columns( :Premium USD ), Statistics( N, Sum ) ),
Column Table( Analysis Columns( :Claim USD ), Statistics( N, Sum ) ),
Row Table( Grouping Columns( :Branch, :Zone ) )
)
);
Code Explanation:
- Open data table;
- Initiate tabulation process.
- Hide control panel.
- Add table to tabulation.
- Analyze Premium USD column.
- Calculate count and sum.
- Analyze Claim USD column.
- Calculate count and sum.
- Group rows by Branch and Zone.
- Display tabulated results.
Example 20
Summary: Creates a tabulation with age, adding height and weight columns, and saving the script for future use.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
tab = dt << Tabulate( Page Column( :age ), Show Control Panel( 0 ), Add Table( Column Table( Analysis Columns( :height, :weight ) ) ) );
saveScript = Char( tab << get script );
certScript = "Tabulate(Page Column(:age), Show Control Panel(0), Add Table(Column Table(Analysis Columns(:height, :weight))))";
tab << close window;
tabCP = dt << Tabulate( Page Column( :age ), Add Table( Column Table( Analysis Columns( :height, :weight ) ) ) );
saveScript2 = Char( tabCP << get script );
certScript2 = "Tabulate(Page Column(:age), Add Table(Column Table(Analysis Columns(:height, :weight))))";
Code Explanation:
- Open data table;
- Create tabulation with age.
- Hide control panel.
- Add height and weight columns.
- Save tabulation script.
- Define certified script.
- Close tabulation window.
- Recreate tabulation with age.
- Save second tabulation script.
- Define second certified script.
Example 21
Summary: Creates a tabulation report with filtered data for State 'NC', adding analysis columns and hiding the control panel.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
tab = dt << Tabulate(
Page Column( :State( "NC" ) ),
Show Control Panel( 0 ),
Add Table( Column Table( Analysis Columns( :OZONE, :CO, :SO2, :NO, :PM10 ) ) )
);
rpt = tab << report;
Code Explanation:
- Open data table;
- Create a tabulation object.
- Filter data for State NC.
- Hide control panel.
- Add analysis columns.
- Generate report object.
Example 22
Summary: Creates a tabulate report with a custom format, grouping columns, and analysis statistics for a given data table.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
tab2 = dt << Tabulate(
Page Column( :age( 15 ) ),
Show Control Panel( 0 ),
Set Format( Name( "% of Total" )(9, 2) ),
Add Table(
Column Table( Analysis Columns( :height, :weight ) ),
Column Table( Statistics( Name( "% of Total" ) ) ),
Row Table( Grouping Columns( :sex ) )
)
);
rpt = tab2 << report;
Code Explanation:
- Open data table.
- Create new tabulate object.
- Set page column to age 15.
- Hide control panel.
- Set format to percent of total.
- Add table to tabulate.
- Set analysis columns to height and weight.
- Set statistics to percent of total.
- Set grouping column to sex.
- Generate report from tabulate.
Example 23
Summary: Creates two tabulations for the NC state, including OZONE, CO, SO2, NO, and PM10 columns, and extracts matrices from the resulting data tables.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
tab1 = dt << Tabulate( Page Column( :State( "NC" ) ), Add Table( Column Table( Analysis Columns( :OZONE, :CO, :SO2, :NO, :PM10 ) ) ) );
tab1Dt = tab1 << Make into Data Table;
tab1Mat = tab1Dt << Get as Matrix;
tab2 = dt << Tabulate(
Page Column( :State( "NC" ) ),
Show Control Panel( 0 ),
Add Table( Column Table( Analysis Columns( :OZONE, :CO, :SO2, :NO, :PM10 ) ) )
);
tab2Dt = tab2 << Make into Data Table;
tab2Mat = tab2Dt << Get as Matrix;
Code Explanation:
- Open data table.
- Create tabulation for NC state.
- Include OZONE, CO, SO2, NO, PM10 columns.
- Convert tabulation to data table.
- Extract matrix from data table.
- Create second tabulation for NC state.
- Hide control panel.
- Include OZONE, CO, SO2, NO, PM10 columns.
- Convert second tabulation to data table.
- Extract matrix from second data table.
Example 24
Summary: Filters and selects data in a table to display specific city and state combinations, utilizing Local Data Filter and Filter Column features.
Code:
dt = Open("data_table.jmp");
tab = dt << Tabulate( Add Table( Column Table( Analysis Columns( :POP ) ) ) );
ldf = tab << Local Data Filter(
Location( {62, 51} ),
Add Filter(
columns( :city, :State ),
Display( :city, Size( 204, 170 ), List Display ),
Display( :State, Size( 204, 170 ), List Display )
)
);
ldf << (Filter Column( :state ) << Where( :state == "TX" ));
ldf << (Filter Column( :city ) << Where( :city == "ATLANTA" ));
ldf << (Filter Column( :city ) << Clear Selection);
ldf << (Filter Column( :state ) << Where( :state == "TX" ));
Code Explanation:
- Open table.
- Create tabulate.
- Add table.
- Add column table.
- Add analysis columns.
- Add local data filter.
- Set filter location.
- Add filter for city and state.
- Set city display.
- Set state display.
Example 25
Summary: Filters and tabulates data in a JMP script, specifically selecting rows with 'TX' state and 'ATLANTA' city, and displaying filtered columns.
Code:
dt = Open("data_table.jmp");
tab = dt << Tabulate( Add Table( Column Table( Analysis Columns( :POP ) ) ) );
df = dt << Data Filter(
Add Filter(
columns( :city, :State ),
Display( :city, Size( 204, 170 ), List Display ),
Display( :State, Size( 204, 170 ), List Display )
)
);
df << (Filter Column( :state ) << Where( :state == "TX" ));
df << (Filter Column( :city ) << Where( :city == "ATLANTA" ));
df << (Filter Column( :city ) << Clear Selection);
df << (Filter Column( :state ) << Where( :state == "TX" ));
Code Explanation:
- Open data table;
- Create tabulation for population column.
- Add data filter to dataset.
- Set filter for city and state columns.
- Display filters with specified sizes.
- Apply filter for state "TX".
- Apply filter for city "ATLANTA".
- Clear selection from city filter.
- Reapply filter for state "TX".
- End script execution.
Example 26
Summary: Creates a filtered data table with aggregated statistics for OZONE, grouped by Region, and limited to rows where State is 'MA'.
Code:
dt = Open("data_table.jmp");
obj = Tabulate(
show control panel( 0 ),
Add Table( Column Table( Aggregate Statistics( :OZONE ) ), Row Table( Grouping Columns( :Region ) ) ),
Local Data Filter(
Add Filter( columns( :OZONE ), Where( :OZONE >= 0.1 & :OZONE <= 0.2 ) ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
),
);
dt << Select Where( :State == "MA" );
dt << Exclude();
dt1 = obj << Make Into Datatable;
Code Explanation:
- Open data table.
- Create tabulate object.
- Hide control panel.
- Add column table for OZONE.
- Add row table grouped by Region.
- Add local data filter for OZONE.
- Set filter condition: 0.1 ‚â§ OZONE ‚â§ 0.2.
- Select rows where State is "MA".
- Exclude selected rows.
- Convert tabulate to new datatable.
Example 27
Summary: Creates a tabulated data table with grouped rows by age and sex, extracting values from the age column.
Code:
dt = Open("data_table.jmp");
dttab = dt << Tabulate( Add Table( Row Table( Grouping Columns( :age, :sex ) ) ) );
dt2 = dttab << Make Into Data Table;
m = dt2:age << Get Values;
Code Explanation:
- Open data table;
- Create tabulate object.
- Add row table to tabulate.
- Group by age and sex.
- Make tabulate into data table.
- Assign new data table to dt2.
- Extract values from age column.
Example 28
Summary: Creates a tabulation window with column statistics and row grouping, formatting mean values as fixed decimals and percentages.
Code:
Open("data_table.jmp");
tab = Tabulate(
Add Table(
Column Table( Statistics( Mean, Name( "% of Total" ), Min, Max ) ),
Row Table( Grouping Columns( :Date ), Analysis Columns( :Acid ) )
)
);
tab << Set Format( Mean( Acid( 10, 3 ) ), Name( "% of Total" )(Acid( 10, 3 )), Min( Acid( 10, 3 ) ), Max( Acid( 10, 3 ) ) );
dt2 = tab << Make Into Data Table;
cert f = "Format(\!"Fixed Dec\!", 10, 3)";
f = Char( dt2:Mean << Get Format );
cert f = "Format(\!"Percent\!", 10, 3)";
f = Char( dt2:Name( "% of Total" ) << Get Format );
cert f = "Format(\!"Fixed Dec\!", 10, 3)";
f = Char( dt2:Min << Get Format );
cert f = "Format(\!"Fixed Dec\!", 10, 3)";
f = Char( dt2:Max << Get Format );
tab << Close Window();
Code Explanation:
- Open data table;
- Create tabulation window.
- Define column statistics.
- Define row grouping and analysis.
- Set format for statistics.
- Convert tabulation to data table.
- Define fixed decimal format string.
- Retrieve current format of Mean column.
- Define percent format string.
- Retrieve current format of % of Total column.
Example 29
Summary: Creates a tabulation with grouped columns by 'age' and 'sex', including analysis columns for 'weight' with mean calculation, and applies a local data filter to select specific age ranges.
Code:
dt = Open("data_table.jmp");
tab = Tabulate(
Add Table(
Column Table( Grouping Columns( :age ) ),
Row Table( Grouping Columns( :sex ), Analysis Columns( :weight ), Statistics( Mean ) )
),
Local Data Filter(
Location( {717, 111} ),
Add Filter( columns( :age ), Where( :age == {12, 13, 14, 15} ) ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
)
) << Make Into Data Table;
Code Explanation:
- Open data table;
- Create a tabulation.
- Add a table to the tabulation.
- Set grouping columns to "age".
- Add row table to the tabulation.
- Set grouping columns to "sex".
- Add analysis columns for "weight".
- Calculate mean for "weight".
- Add local data filter.
- Filter "age" for values 12, 13, 14, 15.
- Convert tabulation to data table.
Example 30
Summary: Creates a tabulated data table with grouped columns for sex, age, and height, utilizing the Tabulate function.
Code:
dt = Open("data_table.jmp");
dtlist = (dt << Tabulate(
Show Control Panel( 0 ),
Add Table( Column Table( Grouping Columns( :sex ) ), Row Table( Grouping Columns( :age ) ), Row Table( Grouping Columns( :height ) ) )
)) << Make Into Data Table( Invisible( 1 ), Output Table( "tabA" ) );
matrx = dtlist << get as matrix;
Close( dt, nosave );
Code Explanation:
- Open table.
- Create tabulation.
- Hide control panel.
- Group by sex.
- Group by age.
- Group by height.
- Convert to data table.
- Make invisible.
- Name output table.
- Convert to matrix.
- Close original table.
Example 31
Summary: Creates a tabulation report with grouping by sex, age, and height, and extracts the data as a matrix.
Code:
dt = Open("data_table.jmp");
dtlist = (dt << Tabulate(
Show Control Panel( 0 ),
Add Table( Column Table( Grouping Columns( :sex ) ), Row Table( Grouping Columns( :age ) ), Row Table( Grouping Columns( :height ) ) )
)) << Make Into Data Table( Invisible( 1 ), Output Table( "tabA" ) );
matrx = dtlist << get as matrix;
Code Explanation:
- Open data table.
- Create tabulation report.
- Hide control panel.
- Group by sex.
- Group by age.
- Group by height.
- Convert report to data table.
- Name output table "tabA".
- Make data table invisible.
- Extract data as matrix.
Example 32
Summary: Creates a tabulated data visualization with summary statistics for 'Sales ($M)' and 'Assets' grouped by 'Type', utilizing JMP's Tabulate platform.
Code:
dt = Open("data_table.jmp");
obj = dt << Tabulate(
Show Control Panel( 0 ),
show chart( 1 ),
Add Table( Column Table( Grouping Columns( :Type ), Analysis Columns( :"Sales ($M)"n, :Assets ), statistics( min, mean, max ) ) )
);
obj << modify table( column table( 1 ), delete( analysis columns( :Assets ) ) );
Code Explanation:
- Open data table;
- Create tabulate object.
- Hide control panel.
- Show chart.
- Add column table.
- Set grouping column to "Type".
- Add analysis columns: "Sales ($M)"n, "Assets".
- Set statistics: min, mean, max.
- Modify table.
- Delete "Assets" from analysis columns.
Example 33
Summary: Creates a tabulated data table summarizing profits by sum, grouped by type and size, from an open JMP data table.
Code:
dt = Open("data_table.jmp");
obj = dt << Tabulate(
Show Control Panel( 0 ),
Add Table( Column Table( Analysis Columns( "Profits($M)"n ), Statistics( Sum ) ), Row Table( Grouping Columns( :type, :size Co ) ) )
);
obj << Modify Table( Row Table( 1 ), Modify Table Option( Stack Grouping Columns( true ) ) );
newTable3 = obj << make into data table;
Code Explanation:
- Open data table.
- Create tabulate object.
- Hide control panel.
- Add column table for profits.
- Summarize profits by sum.
- Group rows by type and size.
- Modify table to stack grouping columns.
- Convert tabulate to data table.
- Assign new data table to variable.
Example 34
Summary: Creates a tabulated table with grouped columns and row tables, displaying statistics for 'Premium USD' and 'Claim USD', while modifying the column table to include an analysis column.
Code:
dt = Open("data_table.jmp");
obj = dt << Tabulate(
Show Control Panel( 0 ),
Add Table( Column Table( Statistics( N ), Grouping Columns( :age ) ), Row Table( Grouping Columns( :sex ) ) )
);
obj << Modify Table( Column Table( 1 ), Retype( Grouping Column( :age ) ), Analysis Column );
Code Explanation:
- Open data table;
- Create tabulation object.
- Hide control panel.
- Add column table with N statistic.
- Group by age in column table.
- Add row table with sex grouping.
- Modify column table.
- Change age to analysis column.
- Update tabulation object.
- Display modified table.
Example 35
Summary: Creates a tabulated data table with grouped columns, analysis columns, and statistics, including range, min, mean, and max.
Code:
dt = Open("data_table.jmp");
obj = dt << Tabulate(
Show Control Panel( 0 ),
Add Table( Column Table( Grouping Columns( :Type ), Analysis Columns( :"Sales ($M)"n, :Assets ), statistics( min, mean, max ) ) )
);
obj << modify table( column table( 1 ), Add( After( Statistics( max ) ), Statistics( Range ) ) );
obj << modify table( Column table( 1 ), Pack( Statistics( Min, Mean, Max, Range ) ) );
Code Explanation:
- Open data table;
- Create tabulation object.
- Hide control panel.
- Define column table.
- Set grouping columns.
- Set analysis columns.
- Define statistics: min, mean, max.
- Modify table: add Range statistic.
- Pack statistics in table.
- Display modified table.
Example 36
Summary: Creates a tabulated data table with grouped columns and statistics, including min, mean, and max values for 'Sales ($M)' and 'Assets', while hiding the control panel.
Code:
dt = Open("data_table.jmp");
obj = dt << Tabulate(
Show Control Panel( 0 ),
Add Table( Column Table( Grouping Columns( :Type ), Analysis Columns( :"Sales ($M)"n, :Assets ), statistics( min, mean, max ) ) )
);
obj << modify table( column table( 1 ), Add( Before First, Statistics( Range ) ) );
Code Explanation:
- Open data table;
- Create tabulation object.
- Hide control panel.
- Add column table.
- Group by Type.
- Analyze Sales ($M) and Assets.
- Calculate min, mean, max.
- Modify table.
- Add column table 1.
- Insert Range statistic before first.
Example 37
Summary: Creates a tabulation report with row and column tables, grouping columns by gender, and redoing analysis to generate a new data table.
Code:
dt = Open("data_table.jmp");
tab = dt << Tabulate(
Add Table(
Row Table( Category Table, Statistics( Column %, Row % ) ),
Column Table( Columns by Categories( :I am working on my career, :I want to see the world ) )
)
);
tab << Modify Table( Column Table( 1 ), Add( Grouping Columns( :Gender ) ) );
tab << Redo Analysis;
newTab2 = tab << Make into data table;
cols = newTab2 << Get column names;
Code Explanation:
- Open data table.
- Create tabulation report.
- Add row table with category statistics.
- Add column table with selected columns.
- Modify table to add gender grouping.
- Redo analysis with modifications.
- Convert report to data table.
- Retrieve column names from new table.
Example 38
Summary: Creates two tabulation objects to summarize and group data from an open JMP data table, with modifications to pack and unpack analysis columns.
Code:
dt = Open("data_table.jmp");
obj = dt << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Statistics( Sum ), Analysis Columns( :City MPG, :Hwy MPG, :Comb MPG ) ),
Row Table( Grouping Columns( :Mfr Name, :Engine ) )
)
);
obj << Modify Table( Column Table( 1 ), Pack( Analysis Columns( City MPG, Hwy MPG, Comb MPG ), Template( "^FIRST (^OTHERS)", "/" ) ) );
obj2 = dt << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table(
Grouping Columns( :Engine ),
Statistics( "% of Total"n ),
Analysis Columns( :City MPG, :Hwy MPG, :Comb MPG ),
Pack( Analysis Columns( City MPG, Hwy MPG, Comb MPG ) )
),
Row Table( Grouping Columns( :Mfr Name ) )
)
);
obj2 << Modify Table( Column Table( 1 ), Unpack( Analysis Columns( :City MPG ) ) );
newTable4 = obj2 << make into data table;
cols = newTable4 << get column names;
Code Explanation:
- Open data table.
- Create tabulation object.
- Hide control panel.
- Add column table with sums.
- Group by manufacturer and engine.
- Modify table to pack analysis columns.
- Create second tabulation object.
- Hide control panel.
- Add column table with percentages.
- Group by engine and manufacturer.
- Modify table to unpack City MPG column.
- Convert tabulation to data table.
- Retrieve column names from new table.
Example 39
Summary: Creates a tabulated data table with grouped columns and aggregate statistics, utilizing the Tabulate function to categorize responses based on gender.
Code:
dt = Open("data_table.jmp");
tab2 = dt << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Grouping Columns( :Gender ), Add Aggregate Statistics( :Gender ), Category Table( All ), Statistics( N, Row % ) ),
Row Table(
Columns by Categories(
:I am working on my career, :I want to get my debt under control, :My home needs some major improvements,
:I come from a large family, :I want to see the world
)
)
)
);
newTab2 = tab2 << Make into data table;
tags2 = newTab2 << get tagged columns( "Stat: N" );
Code Explanation:
- Open data table.
- Create tabulation object.
- Hide control panel.
- Add column table with grouping.
- Add aggregate statistics for gender.
- Include all categories.
- Add row table with columns.
- Convert tabulation to data table.
- Retrieve tagged columns for counts.
- Store result in tags2 variable.
Example 40
Summary: Creates a tabulation with grouped columns and statistics, utilizing the Tabulate platform in JMP.
Code:
dt = Open("data_table.jmp");
tab = dt << Tabulate( Add Table( Column Table( Statistics( Column %, Row % ) ) ) );
tab << Modify Table( Row Table( 1 ), Add( Grouping Columns( :Gender ) ) );
tab << redo analysis;
Code Explanation:
- Open data table;
- Create tabulation.
- Add column table.
- Add statistics: Column %, Row %.
- Modify row table.
- Add grouping columns: Gender.
- Redo analysis.
Example 41
Summary: Creates a tabulated data table with grouped columns and row tables, summarizing miles by season and species.
Code:
dt = Open("data_table.jmp");
tab1 = Tabulate(
Remove Column Label( Grouping Columns( season ) ),
Show Shading( 0 ),
Add Table(
Column Table( Analysis Columns( :miles ), Grouping Column( :season ), Statistics( Mean, Range ) ),
Row Table( Grouping
Column( :species ) )
)
);
dt2 = tab1 << Make Into Data Table( 1 );
Code Explanation:
- Open data table;
- Create Tabulate object.
- Remove column label for season.
- Disable shading.
- Add column table analysis.
- Set miles as analysis column.
- Group by season.
- Calculate mean and range.
- Add row table.
- Group by species.
Example 42
Summary: Creates a tabulation report with custom grouping, analysis, and statistics for a specific data table.
Code:
dt = Open("data_table.jmp");
dt << select rows( 39 :: 40 );
tab3 = Tabulate(
Change Item Label( Grouping Columns( age( All ), "Total" ) ),
Show Control Panel( 0 ),
Show Shading( 0 ),
Show Chart( 1 ),
Add Table(
Column Table( Grouping Columns( :sex ), Analysis Columns( :weight ), Statistics( Mean ) ),
Row Table( Grouping Columns( :age ), Add Aggregate Statistics( :age ) )
)
);
dt2 = tab3 << Make Into Data Table( 1 );
m = dt2 << Get All Columns As Matrix();
Close( dt2, nosave );
Close( dt, nosave );
certm = [1 1 5 2 1 1, 2 2 3 2 1 2];
dt = New Table( "test_valueorder2",
Add Rows( 10 ),
New Property( "Tabulate", Tabulate( Add Table( RowTable( Columns by Categories( :age, :age2 ) ) ) ) ),
New Column( "age",
Character,
Ordinal,
Set Property( "Notes", "Explore data adventurously" ),
Set Property( "Value Ordering", {"11", "12", "13"} ),
Set Values( {"11", "12", "12", "12", "12", "14", "15", "12", "13", "13"} )
),
New Column( "age2",
Character,
Ordinal,
Set Property( "Value Ordering", {"11", "12", "13", "14", "15"} ),
Set Values( {"13", "12", "12", "15", "15", "14", "11", "13", "11", "12"} )
)
);
tab1 = Tabulate( Add Table( RowTable( Columns by Categories( :age, :age2 ) ) ) );
dt2 = tab1 << Make Into Data Table( 1 );
m = dt2 << Get All Columns As Matrix();
Code Explanation:
- Open data table.
- Select specific rows.
- Create tabulation report.
- Convert tabulation to data table.
- Extract columns as matrix.
- Close temporary data tables.
- Define certificate matrix.
- Create new test data table.
- Add properties to new table.
- Perform additional tabulation.
Example 43
Summary: Creates a tabulation object with customized settings and adds column and row tables to analyze data, utilizing the Tabulate function in JMP.
Code:
dt = Open("data_table.jmp");
dt << select rows( 39 :: 40 );
tab3 = Tabulate(
Change Item Label( Grouping Columns( age( All ), "Total" ) ),
Show Control Panel( 0 ),
Show Shading( 0 ),
Show Chart( 1 ),
Add Table(
Column Table( Grouping Columns( :sex ), Analysis Columns( :weight ), Statistics( Mean ) ),
Row Table( Grouping Columns( :age ), Add Aggregate Statistics( :age ) )
)
);
dt2 = tab3 << Make Into Data Table( 1 );
m = dt2 << Get All Columns As Matrix();
Code Explanation:
- Open data table.
- Select specific rows.
- Create tabulation object.
- Configure tabulation settings.
- Add column table to tabulation.
- Add row table to tabulation.
- Convert tabulation to data table.
- Retrieve all columns as matrix.
Example 44
Summary: Creates a tabulation report to analyze data by sex, country, and size, with separate reports for male and female groups.
Code:
dt = Open("data_table.jmp");
tab = Tabulate( Add Table( Column Table( Grouping Columns( :sex, :marital status ) ), Row Table( Grouping Columns( :country, :size ) ) ) );
dt << Select where( :sex == "Male" );
dt << Hide and Exclude( 1 );
tabDt = tab << Make into data table;
tabmatrix1 = tabDt << get as matrix;
Close( tabDt, no save );
dt << Clear Row States;
dt << Select Where( :sex == "Female" );
dt << Hide and Exclude( 1 );
tabDt2 = tab << Make into data table;
tabmatrix2 = tabDt2 << get as matrix;
Code Explanation:
- Open data table.
- Create tabulation report.
- Select male rows.
- Hide and exclude males.
- Convert tabulation to data table.
- Extract data table as matrix.
- Close data table without saving.
- Clear row states in original table.
- Select female rows.
- Hide and exclude females.
Example 45
Summary: Creates a tabulation with grouping by sex, marital status, country, and size, then selects male rows, hides and excludes them, and converts to a data table.
Code:
dt = Open("data_table.jmp");
tab = Tabulate( Add Table( Column Table( Grouping Columns( :sex, :marital status ) ), Row Table( Grouping Columns( :country, :size ) ) ) );
dt << Select where( :sex == "Male" );
dt << Hide and Exclude( 1 );
tabDt = tab << Make into data table;
tabmatrix1 = tabDt << get as matrix;
Code Explanation:
- Open data table;
- Create a tabulation.
- Group by sex, marital status.
- Group rows by country, size.
- Select rows where sex is Male.
- Hide and exclude selected rows.
- Convert tabulation to data table.
- Get data table as matrix.
Example 46
Summary: Creates a tabulated data view with statistical summaries and sample size control, utilizing the Tabulate platform in JMP.
Code:
dt = Open("data_table.jmp");
obj = dt << Tabulate(
Add Table( Column Table( Statistics( Mean, Std Dev ) ), Row Table( Analysis Columns( :ForSc, :SideSc, :CD3, :CD8, :CD4, :MCB ) ) )
);
obj << Test Build( Sample Size( 100 ) );
mytab = obj << Test Data View;
Code Explanation:
- Open data table;
- Create Tabulate object.
- Add Column Table with Mean and Std Dev.
- Add Row Table with specified columns.
- Set sample size to 100.
- Generate Test Build.
- Create Test Data View.
- Assign to mytab variable.
Example 47
Summary: Creates a tabulation report with row grouping by categories, utilizing the Tabulate and Add Table functions in JMP.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", invisible );
tab = dt << Tabulate( Add Table( Row Table( Columns by Categories( :Grades, :Sports, :Looks, :Money ) ) ) );
dtTab = tab << Make into data table( invisible );
tabMat = dtTab << Get as Matrix;
Code Explanation:
- Open data table.
- Create tabulation report.
- Add row table to report.
- Group columns by categories.
- Convert report to data table.
- Extract data table as matrix.
Example 48
Summary: Creates a tabulated data table with mean values for OZONE grouped by Region, and changes the label to 'Average'.
Code:
dt = Open("data_table.jmp");
tab = dt << Tabulate(
Add Table( Column Table( Analysis Columns( :OZONE ), Statistics( Mean ) ), Row Table( Grouping Columns( :Region ) ) )
);
tab << Change Item Label( Statistics( Mean, "Average" ) );
dtTab = tab << make into data table;
colNames = dtTab << Get Column Names;
Code Explanation:
- Open data table.
- Create tabulate object.
- Add column table for OZONE mean.
- Add row table grouped by Region.
- Change mean label to Average.
- Convert tabulate to data table.
- Retrieve column names.
Example 49
Summary: Creates a tabulated data table with grouped columns and statistics, utilizing the Tabulate analysis in JMP.
Code:
dt = Open("data_table.jmp");
tab = dt << Tabulate(
Show Control Panel( 0 ),
Order by count of grouping columns( 1 ),
Add Table( Column Table( Analysis Columns( :height, :weight ), Statistics( Max ) ), Row Table( Grouping Columns( :age, :sex ) ) )
);
dtTab = tab << Make into data table;
tabMatrix = dtTab << Get as Matrix;
Code Explanation:
- Open data_table data
- Create a tabulate analysis.
- Hide control panel.
- Order by grouping column count.
- Add column table for height and weight.
- Calculate max statistics.
- Add row table for age and sex.
- Convert tabulate to data table.
- Extract data table as matrix.
Example 50
Summary: Creates a tabulation object with column statistics and row grouping, generating a data table with categorized columns.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", invisible );
tab = dt << Tabulate(
Add Table(
Column Table( Statistics( Name( "% of Total" ) ), Category Table( All ) ),
Row Table(
Grouping Columns( :Gender ),
Add Aggregate Statistics( :Gender ),
Columns by Categories( :Grades, :Sports, :Looks, :Money )
)
)
);
dtTab = tab << Make into data table( invisible );
tabMat = dtTab << get as matrix;
Close( dt, no save );
var = "abc";
Code Explanation:
- Open data table.
- Create tabulation object.
- Add table to tabulation.
- Set column statistics to percentage.
- Include all categories.
- Group rows by gender.
- Add aggregate statistics for gender.
- Categorize columns by grades, sports, looks, money.
- Convert tabulation to data table.
- Extract data as matrix.
Example 51
Summary: Fits a standard least squares model with a prediction profiler, utilizing the Tabulate function to generate a data table and matrix.
Code:
dt = Open("data_table.jmp");
obj = dt << Tabulate(
Add Table( Column Table( Statistics( Mean, Std Dev ) ), Row Table( Analysis Columns( :ForSc, :SideSc, :CD3, :CD8, :CD4, :MCB ) ) )
);
var = 20;
obj << Test Build( Sample Size( var ) );
tabDt = obj << Make into data table();
tabMatrix = tabDt << Get as Matrix;
Code Explanation:
- Open data table.
- Create tabulation object.
- Add column statistics.
- Set analysis columns.
- Assign variable value.
- Build test with sample size.
- Convert to data table.
- Extract as matrix.
Example 52
Summary: Creates a data table from a tabulation object, specifying analysis columns and statistics for age, height, and weight.
Code:
dt = Open("data_table.jmp");
catTab = Tabulate(
Show Control Panel( 0 ),
Add Table( Column Table( Analysis Columns( :age, :height, :weight ), Statistics( N Categories ) ) )
);
catTable = catTab << Make into Data Table;
rowVector = catTable << Get as matrix;
Code Explanation:
- Open data table;
- Create tabulation object.
- Hide control panel.
- Add column table analysis.
- Specify age, height, weight columns.
- Request N Categories statistics.
- Convert tabulation to data table.
- Retrieve data table as matrix.
Example 53
Summary: Creates a tabulated data table with grouped columns and rows, utilizing the Tabulate function to summarize data from the 'data_table.jmp' file.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", private );
tab = dt << Tabulate(
Show Control Panel( 0 ),
Add Table( Column Table( Grouping Columns( :sex ) ), Row Table( Grouping Columns( :age ) ) )
);
stable = tab << Make Into Data Table( invisible, table name( "Stealth Table" ) );
seeIt = stable << Has Data View;
Code Explanation:
- Open data table.
- Create tabulation object.
- Hide control panel.
- Define column and row grouping.
- Convert tabulation to data table.
- Make new table invisible.
- Name new table "Stealth Table".
- Check if new table has data view.
Example 54
Summary: Creates a tabulation with grouped columns and row tables to analyze data from an open JMP data table.
Code:
dt = Open("data_table.jmp");
tab = dt << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Grouping Columns( :Prior ), Statistics( N, Name( "% of Total" ), Row %, Column % ) ),
Row Table( Grouping Columns( :Cell Type ) ),
Row Table( Grouping Columns( :Treatment ) )
)
);
tab << make into data table;
dtab1 = Data Table( 1 ) << get as matrix;
dtab2 = Data Table( 2 ) << get as matrix;
Code Explanation:
- Open data table;
- Create tabulation.
- Hide control panel.
- Add column table.
- Group by "Prior".
- Calculate N, % of Total, Row %, Column %.
- Add row table.
- Group by "Cell Type".
- Add another row table.
- Group by "Treatment".
Example 55
Summary: Creates a tabulation with column statistics and row grouping, allowing for dynamic adjustment of column width.
Code:
dt = Open("data_table.jmp");
tab = dt << Tabulate(
Show Control Panel( 0 ),
Add Table( Column Table( Statistics( N, Name( "% of Total" ) ) ), Row Table( Grouping Columns( :age ) ) ),
Display Column Width( Data Column( "% of Total" ), 120 )
);
width = tab << Display Column Width( Data Column( "% of Total" ) );
tab << Display Column Width( Data Column( "% of Total" ), 240 );
width = tab << Display Column Width( Data Column( "% of Total" ) );
tab << Display Column Width( Data Column( "% of Total" ), 0 );
width = tab << Display Column Width( Data Column( "% of Total" ) );
tab << Display Column Width( Data Column( "% of Total" ), -1 );
width = tab << Display Column Width( Data Column( "% of Total" ) );
tabScript = Char( tab << Get Script );
Code Explanation:
- Open data table.
- Create tabulation.
- Hide control panel.
- Add column table with statistics.
- Set initial column width.
- Retrieve current column width.
- Increase column width.
- Retrieve updated column width.
- Set column width to zero.
- Retrieve column width after reset.
- Set column width to auto.
- Retrieve final column width.
- Get script for tabulation.
Example 56
Summary: Creates a tabulation report with grouped columns and row tables, displaying column widths for specific labels.
Code:
dt = Open("data_table.jmp");
tab = dt << Tabulate(
show panel( 0 ),
Add Table(
Column Table( Grouping Columns( :sex, :marital status ), Analysis Columns( :age ), Statistics( Sum, "% of Total" ) ),
Row Table( Grouping Columns( :type ) ),
Row Table( Grouping Columns( :country, :size ) )
)
);
tab << Display Column Width( Row Label( Row Table( 2 ), "country" ), 150 );
width = tab << Display Column Width( Row Label( Row Table( 2 ), "country" ) );
tab << Display Column Width( Row Label( Row Table( 2 ), "size" ), 150 );
width2 = tab << Display Column Width( Row Label( Row Table( 2 ), "size" ) );
tabScript = Char( tab << Get Script );
Code Explanation:
- Open data table;
- Create tabulation report.
- Hide panel.
- Add column table.
- Group by sex and marital status.
- Analyze age with sum and percentage.
- Add row table.
- Group by type.
- Add second row table.
- Group by country and size.
Example 57
Summary: Creates a tabulation report with column and row tables, filtering data by region, and adding new rows to the table.
Code:
dt = Open("data_table.jmp");
tab = dt << Tabulate(
Show Control Panel( 1 ),
Add Table( Column Table( Analysis Columns( :SAT Verbal ) ), Row Table( Grouping Columns( :Region ) ) )
);
dt << Select Where( :region == "Midwest" );
dt << delete rows();
dtTab = tab << Make into Data Table;
rownum = 353;
For( i = 1, i <= 5, i++,
dt << add rows( 1 );
dt:region[rownum] = "Central";
rownum++;
);
dtTab2 = tab << Make into Data Table;
Close( dt, no save );
Code Explanation:
- Open data table.
- Create tabulation report.
- Show control panel.
- Add column table for SAT Verbal.
- Add row table grouped by Region.
- Select Midwest region rows.
- Delete selected rows.
- Convert tabulation to data table.
- Initialize row number.
- Loop to add Central region rows.
Example 58
Summary: Creates a grouped data table from an existing data table, utilizing Tabulate to add column and row tables based on sex and age grouping.
Code:
dt = Open("data_table.jmp");
obj = Tabulate();
obj << Add Table( Column Table( Grouping Columns( :sex ) ) );
obj << Add table( row table( grouping column( :age ) ) );
dtTab = obj << Make into data table;
Code Explanation:
- Open data table;
- Create a new tabulate object.
- Add a column table with sex grouping.
- Add a row table with age grouping.
- Convert tabulate to data table.
- Assign result to dtTab.
Example 59
Summary: Creates a data table with mean OZONE values and CO analysis, grouped by Region.
Code:
dt = Open("data_table.jmp");
obj = Tabulate( Add Table( Column Table( Analysis Columns( :OZONE ), Statistics( Mean ) ), Row Table( Grouping Columns( :Region ) ) ) );
obj << modifytable( column table( 1 ), analysis columns( :CO ) );
dtTab = obj << Make into data table;
Code Explanation:
- Open data table.
- Create tabulate object.
- Add column table for OZONE mean.
- Add row table with Region grouping.
- Modify table to include CO.
- Convert tabulate to data table.
Example 60
Summary: Creates a grouped data table from an existing data table, with columns for sex and age.
Code:
dt = Open("data_table.jmp");
obj = Tabulate();
obj << Add Table( Column Table( Grouping Columns( :sex ) ) );
obj << modify table( column table( 1 ), grouping column( :age ) );
dtTab = obj << Make into data table;
Code Explanation:
- Open data table;
- Create tabulation object.
- Add column table.
- Group by "sex".
- Modify first column table.
- Group by "age".
- Convert tabulation to data table.
- Assign result to dtTab.
Example 61
Summary: Creates a data table with categorized columns by grouping 'Grades', 'Sports', and 'Looks' categories, and adds a new column for 'Money'.
Code:
dt = Open("data_table.jmp");
obj = Tabulate( Add Table( Row Table( Columns by Categories( :Grades, :Sports, :Looks ) ) ) );
obj << modify table( row table( 1 ), columns by categories( :Money ) );
dtTab = obj << Make into data table;
Code Explanation:
- Open data table.
- Create tabulation object.
- Add row table to tabulation.
- Define columns by categories.
- Modify existing row table.
- Add 'Money' column to categories.
- Convert tabulation to data table.
Example 62
Summary: Creates a data table with grouped columns and tables for sex, age, height, and weight analysis.
Code:
dt = Open("data_table.jmp");
obj = Tabulate();
obj << Add Table( Column Table( Grouping Columns( :sex ) ) );
obj << Add table( row table( grouping column( :age ) ) );
obj << Add Table( Column Table( Analysis Column( :height ) ) );
obj << Add Table( Column Table( Analysis Column( :Weight ) ) );
obj << Modify Table( Column Table( 2 ), statistics( min, max ) );
dtTab = obj << Make into data table;
Code Explanation:
- Open data table;
- Create new tabulate object.
- Add column table with sex grouping.
- Add row table with age grouping.
- Add column table for height analysis.
- Add column table for weight analysis.
- Modify height table to show min and max.
- Convert tabulate to data table.
- Assign result to dtTab variable.
Example 63
Summary: Creates a tabulation object to analyze sales data, grouping by type and calculating summary statistics, then modifies the table to remove assets.
Code:
dt = Open("data_table.jmp");
obj = Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Grouping Columns( :Type ), Analysis Columns( :Name( "Sales ($M)" ), :Assets ), statistics( min, mean, max ) )
)
);
obj << modify table( column table( 1 ), delete( analysis columns( :Assets ) ) );
dtTab = obj << Make into data table;
Code Explanation:
- Open data table.
- Create tabulation object.
- Hide control panel.
- Add table to tabulation.
- Group by "Type".
- Analyze "Sales ($M)" and "Assets".
- Calculate min, mean, max.
- Modify table to remove "Assets".
- Convert tabulation to data table.
- Assign result to dtTab.
Example 64
Summary: Runs data manipulation and visualization by creating multiple tabulation objects, modifying tables, and extracting values from a JMP data table.
Code:
dt = Open("data_table.jmp");
obj1 = Tabulate( Add Table( Row Table( Columns by Categories( :Grades, :Sports, :Looks ) ) ) );
obj1 << modify table( row table( 1 ), columns by categories( :Money ) );
dt2 = obj1 << Make into data table;
matrix1 = dt2 << Get as Matrix;
obj2 = dt << Tabulate( Show Control Panel( 0 ), Add Table( Row Table( Grouping Columns( :Grades, :Sports, :Looks, :Money ) ) ) );
dt3 = obj2 << Make into data table;
getvals = dt3:Money << Get values;
obj3 = dt << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Grouping Columns( :Race, :Sports, :Grades ) ),
Row Table( Grouping Columns( :Name( "Urban/Rural" ), :Looks ) )
)
);
dt4 = obj3 << Make into data table;
vals2 = As Column( dt4, "Urban/Rural" ) << get values;
Close( dt2, nosave );
Close( dt3, nosave );
Code Explanation:
- Open data table.
- Create initial tabulation object.
- Modify tabulation to add 'Money' column.
- Convert tabulation to data table.
- Extract matrix from data table.
- Create second tabulation object with control panel hidden.
- Convert second tabulation to data table.
- Retrieve 'Money' values from data table.
- Create third tabulation object with specified grouping.
- Convert third tabulation to data table and close temporary tables.
Example 65
Summary: Creates a tabulation report with aggregate statistics and column categorization, utilizing the Tabulate function to generate a data table.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", invisible );
tab = dt << Tabulate(
Add Table(
Column Table( Statistics( Name( "% of Total" ) ), Category Table( All ) ),
Row Table(
Grouping Columns( :Gender ),
Add Aggregate Statistics( :Gender ),
Columns by Categories( :Grades, :Sports, :Looks, :Money )
)
)
);
dtTab = tab << Make into data table( invisible );
tabMat = dtTab << get as matrix;
Code Explanation:
- Open data table;
- Create tabulation report.
- Set column statistics.
- Set row grouping.
- Add aggregate statistics.
- Define columns by categories.
- Convert report to data table.
- Get data table as matrix.
Example 66
Summary: Fits a standard least squares model with a prediction profiler, utilizing the Tabulate platform to generate a data table and matrix.
Code:
dt = Open("data_table.jmp");
obj = dt << Tabulate(
Add Table( Column Table( Statistics( Mean, Std Dev ) ), Row Table( Analysis Columns( :ForSc, :SideSc, :CD3, :CD8, :CD4, :MCB ) ) )
);
var = 35;
obj << Test Build( Sample Size( var ) );
tabDt = obj << Make into data table();
tabMatrix = tabDt << Get as Matrix;
Code Explanation:
- Open table.
- Create tabulation object.
- Add column statistics.
- Set analysis columns.
- Define variable.
- Build test with sample size.
- Convert to data table.
- Extract data as matrix.
Example 67
Summary: Creates a tabulated data table, filtering by region and adding new rows to simulate changes in regional data.
Code:
dt = Open("data_table.jmp");
tab = dt << Tabulate(
Show Control Panel( 1 ),
Add Table( Column Table( Analysis Columns( :SAT Verbal ) ), Row Table( Grouping Columns( :Region ) ) )
);
dt << Select Where( :region == "Midwest" );
dt << delete rows();
dtTab = tab << Make into Data Table;
rownum = 353;
For( i = 1, i <= 5, i++,
dt << add rows( 1 );
dt:region[rownum] = "Central";
rownum++;
);
dtTab2 = tab << Make into Data Table;
Code Explanation:
- Open data table.
- Create tabulation.
- Enable control panel.
- Add column and row tables.
- Group by region.
- Select Midwest rows.
- Delete selected rows.
- Convert tabulation to data table.
- Initialize row number.
- Loop to add new rows.
Example 68
Summary: Creates a tabulated data table with grouped columns and analysis statistics, utilizing the Tabulate platform in JMP.
Code:
dt = Open("data_table.jmp");
tab = Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Grouping Columns( :sex, :marital status ), Analysis Columns( :age ), Statistics( Mean, Std Dev ) ),
Row Table( Grouping Columns( :country, :size ) )
)
);
dTab1 = tab << make into data table( Full Path Column Name( 1 ) );
dTab2 = tab << make into data table();
tab << remove column label( grouping columns( :marital status, :sex ) );
dTab3 = tab << make into data table( Full Path Column Name( 1 ) );
dTab4 = tab << make into data table();
Code Explanation:
- Open data table;
- Create tabulation.
- Hide control panel.
- Add column table.
- Group by sex, marital status.
- Analyze age.
- Calculate mean, standard deviation.
- Add row table.
- Group by country, size.
- Make first data table.
- Make second data table.
- Remove marital status, sex labels.
- Make third data table.
- Make fourth data table.
Example 69
Summary: Runs data manipulation and visualization by creating multiple tabulation objects, modifying tables, and extracting values from a 'Money' column.
Code:
dt = Open("data_table.jmp");
obj1 = Tabulate( Add Table( Row Table( Columns by Categories( :Grades, :Sports, :Looks ) ) ) );
obj1 << modify table( row table( 1 ), columns by categories( :Money ) );
dt2 = obj1 << Make into data table;
matrix1 = dt2 << Get as Matrix;
obj2 = dt << Tabulate( Show Control Panel( 0 ), Add Table( Row Table( Grouping Columns( :Grades, :Sports, :Looks, :Money ) ) ) );
dt3 = obj2 << Make into data table;
getvals = dt3:Money << Get values;
obj3 = dt << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Grouping Columns( :Race, :Sports, :Grades ) ),
Row Table( Grouping Columns( :Name( "Urban/Rural" ), :Looks ) )
)
);
dt4 = obj3 << Make into data table;
vals2 = As Column( dt4, "Urban/Rural" ) << get values;
Code Explanation:
- Open data table.
- Create tabulation object.
- Modify tabulation object.
- Convert tabulation to data table.
- Extract matrix from data table.
- Create another tabulation object.
- Convert second tabulation to data table.
- Extract values from "Money" column.
- Create third tabulation object.
- Convert third tabulation to data table.
Example 70
Summary: Analyze miles by season, grouping results by species and displaying mean and range statistics.
Code:
dt = Open("data_table.jmp");
tab1 = Tabulate(
Remove Column Label( Grouping Columns( season ) ),
Show Shading( 0 ),
Add Table(
Column Table( Analysis Column( :miles ), Grouping Column( :season ), Statistics( Mean, Range ) ),
Row Table( Grouping
Column( :species ) )
)
);
Code Explanation:
- Open data table;
- Create tabulate object.
- Remove column label for season.
- Disable shading.
- Add table to tabulate.
- Analyze miles by season.
- Calculate mean and range.
- Group by species.
- Display tabulate results.
Example 71
Summary: Runs the transformation and analysis of a data table by applying various mathematical functions to the 'height' column, including square root, logarithmic, exponential, and more, while calculating mean statistics for each transformation.
Code:
dt = Open("data_table.jmp");
tab = dt << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table(
Analysis Columns(
:height,
Transform Column( "Square Root[height]", Formula( Sqrt( :height ) ) ),
Transform Column( "height^2", Formula( :height * :height ) ),
Transform Column( "Log[height]", Formula( Log( :height ) ) ),
Transform Column( "Exp[height]", Formula( Exp( :height ) ) ),
Transform Column( "Log10[height]", Formula( Log10( :height ) ) ),
Transform Column( "10^height", Formula( 10 ^ :height ) ),
Transform Column( "Cube Root[height]", Formula( Root( :height, 3 ) ) ),
Transform Column( "height^3", Formula( :height ^ 3 ) ),
Transform Column( "1/height", Formula( 1 / :height ) ),
Transform Column( "Abs[height]", Formula( Abs( :height ) ) ),
Transform Column( "-height", Formula( -:height ) ),
Transform Column( "Arrhenius[height]", Formula( Arrhenius( :height ) ) ),
Transform Column( "Arrhenius Inverse[height]", Formula( Arrhenius Inv( :height ) ) ),
Transform Column( "Logit[height]", Formula( Logit( :height ) ) ),
Transform Column( "Logistic[height]", Formula( Logist( :height ) ) ),
Transform Column( "Logit[height%]", Formula( Logit Percent( :height ) ) ),
Transform Column( "Logistic[height%]", Formula( Logist Percent( :height ) ) )
),
Statistics( Mean )
)
)
);
tabDt = tab << make into data table;
tabMat = tabDt << Get as Matrix;
Code Explanation:
- Open data table;
- Create Tabulate report.
- Hide control panel.
- Add column table.
- Set analysis columns: height.
- Transform height to square root.
- Transform height to square.
- Transform height to log.
- Transform height to exp.
- Transform height to log10.
- Transform height to 10^height.
- Transform height to cube root.
- Transform height to cube.
- Transform height to reciprocal.
- Transform height to absolute value.
- Transform height to negative.
- Transform height using Arrhenius function.
- Transform height using Arrhenius inverse.
- Transform height using Logit function.
- Transform height using Logistic function.
- Transform height using Logit percent.
- Transform height using Logistic percent.
- Calculate mean for each transformation.
- Convert Tabulate report to data table.
- Extract data table as matrix.
Example 72
Summary: Creates a tabulation report with grouping by sex and age, selecting columns, and deleting all columns.
Code:
dt = Open("data_table.jmp");
dt << Tabulate( Show Control Panel( 0 ), Add Table( Column Table( Grouping Columns( :sex ) ), Row Table( Grouping Columns( :age ) ) ) );
:age << set selected;
:sex << set selected;
dt << Delete Columns();
Code Explanation:
- Open data table;
- Create tabulation report.
- Hide control panel.
- Add column table.
- Group by sex.
- Add row table.
- Group by age.
- Select age column.
- Select sex column.
- Delete all columns.
Example 73
Summary: Runs data manipulation and analysis by opening a data table, creating tabulations, modifying tables, making data tables from tabulations, extracting matrices, and getting values.
Code:
dt = Open("data_table.jmp");
obj1 = Tabulate( Add Table( Row Table( Columns by Categories( :Grades, :Sports, :Looks ) ) ) );
obj1 << modify table( row table( 1 ), columns by categories( :Money ) );
dt2 = obj1 << Make into data table;
matrix1 = dt2 << Get as Matrix;
Close( dt2, nosave );
obj2 = dt << Tabulate( Show Control Panel( 0 ), Add Table( Row Table( Grouping Columns( :Grades, :Sports, :Looks, :Money ) ) ) );
dt3 = obj2 << Make into data table;
getvals = dt3:Money << Get values;
Code Explanation:
- Open data table.
- Create initial tabulation.
- Modify tabulation to add column.
- Convert tabulation to data table.
- Extract matrix from data table.
- Close temporary data table.
- Create second tabulation with control panel.
- Convert second tabulation to data table.
- Extract values from Money column.
Example 74
Summary: Creates a tabulated data table with grouped columns and rows, extracting 'Urban/Rural' values from the resulting data.
Code:
dt4 = Open("data_table.jmp");
obj3 = dt4 << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Grouping Columns( :Race, :Sports, :Grades ) ),
Row Table( Grouping Columns( :Name( "Urban/Rural" ), :Looks ) )
)
);
dt5 = obj3 << Make into data table;
vals2 = As Column( dt5, "Urban/Rural" ) << get values;
Close( dt5, nosave );
Code Explanation:
- Open data table.
- Create tabulation object.
- Hide control panel.
- Define column grouping.
- Define row grouping.
- Convert tabulation to data table.
- Extract "Urban/Rural" values.
- Close temporary data table.
Example 75
Summary: Creates a data table with categorized columns, including 'Money', by modifying a tabulate object and converting it to a matrix.
Code:
dt = Open("data_table.jmp");
obj1 = Tabulate( Add Table( Row Table( Columns by Categories( :Grades, :Sports, :Looks ) ) ) );
obj1 << modify table( row table( 1 ), columns by categories( :Money ) );
dt2 = obj1 << Make into data table;
matrix1 = dt2 << Get as Matrix;
Code Explanation:
- Open data table;
- Create tabulate object.
- Add row table with categories.
- Modify table to add "Money".
- Make tabulate into data table.
- Convert data table to matrix.
Example 76
Summary: Creates a tabulation object with grouped columns and rows, extracting values from a specific column.
Code:
dt4 = Open("data_table.jmp");
obj3 = dt4 << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Grouping Columns( :Race, :Sports, :Grades ) ),
Row Table( Grouping Columns( :Name( "Urban/Rural" ), :Looks ) )
)
);
dt5 = obj3 << Make into data table;
vals2 = As Column( dt5, "Urban/Rural" ) << get values;
Code Explanation:
- Open data table.
- Create tabulation object.
- Hide control panel.
- Add column table.
- Group by Race, Sports, Grades.
- Add row table.
- Group by Urban/Rural, Looks.
- Convert tabulation to data table.
- Extract "Urban/Rural" column.
- Get values from column.
Example 77
Summary: Creates and customizes a tabulation by age, adding height and weight columns, and saving the script for future use.
Code:
dt = Open("data_table.jmp");
tab = dt << Tabulate( Page Column( :age ), Show Control Panel( 0 ), Add Table( Column Table( Analysis Columns( :height, :weight ) ) ) );
saveScript = Char( tab << get script );
certScript = "Tabulate(Page Column(:age), Show Control Panel(0), Add Table(Column Table(Analysis Columns(:height, :weight))))";
tab << close window;
tabCP = dt << Tabulate( Page Column( :age ), Add Table( Column Table( Analysis Columns( :height, :weight ) ) ) );
saveScript2 = Char( tabCP << get script );
certScript2 = "Tabulate(Page Column(:age), Add Table(Column Table(Analysis Columns(:height, :weight))))";
tabCP << Close Window;
Code Explanation:
- Open data table;
- Create tabulation by age.
- Hide control panel.
- Add height and weight columns.
- Save tabulation script.
- Define certification script.
- Close tabulation window.
- Recreate tabulation by age.
- Save tabulation script again.
- Define certification script again.
- Close tabulation window.
Example 78
Summary: Creates a tabulated data table with age statistics and country grouping, modifying the table to add standard deviation and delete range and sum statistics.
Code:
dt = Open("data_table.jmp");
obj2 = dt << Tabulate(
Add Table(
Column Table( Analysis Columns( :age ), Statistics( Range, Min, Max, Sum ), Pack( Statistics( Min, Max ) ) ),
Row Table( Grouping Columns( :country ) )
)
);
obj2 << Modify Table( Column Table( 1 ), Delete( Statistics( "Range", "Sum" ) ) );
obj2 << modify table( column table( 1 ), Add( Statistics( "Std Dev" ) ) );
newtab2 = obj2 << make into data table;
cols2 = newtab2 << get column names;
Code Explanation:
- Open data table;
- Create tabulation object.
- Add column table with age statistics.
- Add row table with country grouping.
- Modify table to delete Range and Sum.
- Add Std Dev to column table.
- Convert tabulation to data table.
- Retrieve column names from new table.
Example 79
Summary: Calculates and visualizes summary statistics for a grouped data table, including median, quantiles, mean, standard deviation, and more.
Code:
dt = Open("data_table.jmp");
mytab = dt << Tabulate(
Add Table(
Column Table( Grouping Columns( :age ) ),
Row Table(
Grouping Columns( :sex ),
Analysis Columns( :height ),
Statistics(
Median,
Quantiles( 50 ),
Quantiles( 1 ),
Quantiles( 99 ),
Mean,
Std Dev,
Min,
Max,
Range,
Name( "% of Total" ),
N Missing,
Sum,
Sum Wgt,
Variance,
Std Err,
CV
)
)
)
);
dt2 = mytab << Make Into Data Table;
m = dt2 << Get as Matrix;
Code Explanation:
- Open data table;
- Create tabulation.
- Group by age.
- Group by sex.
- Analyze height.
- Calculate median.
- Calculate 50th percentile.
- Calculate 1st percentile.
- Calculate 99th percentile.
- Convert tabulation to data table.
Example 80
Summary: Runs the analysis and reporting process for a baseline dataset, utilizing Tabulate to create a column table with statistics and a row table with grouping.
Code:
dt = Open("data_table.jmp");
obj = Tabulate(
Show Control Panel( 0 ),
Show Shading( 0 ),
Add Table( Column Table( Analysis Columns( :Baseline ), Statistics( N ) ), Row Table( Grouping Columns( :Testers ) ) )
);
:Baseline << Set Property( "Missing Value Codes", 0 );
:Baseline << Set Values( [0] );
obj2 = obj << Redo Analysis;
rpt = obj2 << Report;
expr = Parse( rpt[MultiTblNumColBox( 1 )] << Get Journal );
actN = Arg( Extract Expr( expr, Data( Wild List() ) ), 1 );
Code Explanation:
- Open data table.
- Create tabulation object.
- Hide control panel and shading.
- Add column table with baseline analysis.
- Add row table with testers grouping.
- Set missing value codes for Baseline.
- Set Baseline values to zero.
- Redo the analysis.
- Generate report from analysis.
- Parse report journal to extract expression.
Example 81
Summary: Tabulates data by grouping columns, adding a column table with analysis statistics, and saving the result as a new data table.
Code:
dt = Open("data_table.jmp");
tab1 = Tabulate(
Remove Column Label( Grouping Columns( season ) ),
Show Shading( 0 ),
Add Table(
Column Table( Analysis Columns( :miles ), Grouping Column( :season ), Statistics( Mean, Range ) ),
Row Table( Grouping
Column( :species ) )
)
);
dt2 = tab1 << Make Into Data Table( 1 );
dt2 << Save( "$TEMP/" || "tabulatedata_table.jmp" );
dt2 << Set Name( "Original" );
Code Explanation:
- Open data table.
- Create tabulate object.
- Remove column label for season.
- Disable shading.
- Add column table with miles analysis.
- Group by season.
- Calculate mean and range.
- Add row table with species grouping.
- Convert tabulate to data table.
- Save as tabulateAnimals.jmp.
- Rename data table to "Original".
Example 82
Summary: Creates a tabulated report with summary statistics for 'height' and 'weight' columns, utilizing the Tabulate function to generate a data table.
Code:
dt = Open("data_table.jmp");
tab = dt << Tabulate( Add Table( Column Table( Analysis Columns( :height, :weight ) ) ) );
tabDt = tab << make into data table;
Code Explanation:
- Open data table;
- Create Tabulate report.
- Add height and weight columns.
- Convert report to data table.
Tabulate using New Column
Example 1
Summary: Creates a tabular report with a profiler plot, grouping data by 'age' and 'sex', analyzing 'height' statistics, and displaying the results in a JMP data table.
Code:
dt = Open("data_table.jmp");
dt << New Column( "id",
Numeric,
Continuous,
Format( "Best", 12 ),
Set Values( [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1] )
);
tab = dt << Tabulate(
Show Chart( 1 ),
Show Control Panel( 0 ),
Plot Scale( 60, 90 ),
Add Table(
Column Table( Grouping Columns( :age, :sex ), Analysis Columns( :height ), Statistics( Mean ) ),
Row Table( Grouping Columns( :id ) )
)
);
Code Explanation:
- Open data table.
- Create new column "id".
- Set column properties.
- Assign values to "id".
- Initiate tabulation process.
- Enable chart display.
- Disable control panel.
- Set plot scale.
- Define column table with grouping and analysis columns.
- Define row table with grouping column.
Example 2
Summary: Creates and configures multiple tabulations in JMP, including data visualization, grouping, and statistical analysis.
Code:
dt = Open("data_table.jmp");
dt << New Column( "id",
Numeric,
Continuous,
Format( "Best", 12 ),
Set Values( [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1] )
);
tab = dt << Tabulate(
Show Chart( 1 ),
Show Control Panel( 0 ),
Plot Scale( 60, 90 ),
Add Table(
Column Table( Grouping Columns( :age, :sex ), Analysis Columns( :height ), Statistics( Mean ) ),
Row Table( Grouping Columns( :id ) )
)
);
dt = Open("data_table.jmp");
tab8 = dt << Tabulate(
Show Control Panel( 0 ),
Order by count of grouping columns( 1 ),
Add Table(
Column Table( Grouping Columns( :Gender ), Statistics( N, Column % ) ),
Row Table( Grouping Columns( :Single Status ) ),
Row Table( Grouping Columns( :Job Satisfaction ) ),
Row Table( Grouping Columns( :Brush After Waking Up ) ),
Row Table( Grouping Columns( :I come from a large family ) ),
Row Table( Grouping Columns( :Floss Other ) )
)
);
Code Explanation:
- Open data table;
- Create new column "id".
- Set values for "id" column.
- Generate tabulation for "data_table".
- Display chart in tabulation.
- Hide control panel in tabulation.
- Set plot scale to 60, 90.
- Group by age and sex, analyze height mean.
- Group by id.
- Open data table;
- Generate tabulation for "data_table".
- Hide control panel in tabulation.
- Order by count of grouping columns.
- Group by Gender, analyze N and Column %.
- Group by Single Status.
- Group by Job Satisfaction.
- Group by Brush After Waking Up.
- Group by I come from a large family.
- Group by Floss Other.
Example 3
Summary: Process of recoding values in a target column and generating a tabulate report with statistics, utilizing JMP's data update feature.
Code:
dt = Open("data_table.jmp");
dt << Begin Data Update;
col1 = dt << New Column( dt:Series Full );
col1 << Set Name( "Series Full 2" );
dt << Move Selected Columns( {col1}, after( dt:Series Full ) );
dt << Recode Column(
dt:Series Full,
{Recode(
_rcNow,
{Map Value( _rcNow, {"doz.", "dozens", "gal.", "gallons", "lb.", "pounds", "oz.", "ounces", "gm)", "grams)", "lit)", "liters)"} )},
By Word( Delimiters( Get Whitespace Characters() ) )
)},
Target Column( col1 )
);
dt << End Data Update;
dtTab = dt << Tabulate(
Show Control Panel( 0 ),
Add Table( Column Table( Statistics( N, Name( "% of Total" ) ) ), Row Table( Grouping Columns( :Series Full 2 ) ) )
);
newTab = dtTab << Make Into Data Table;
tabList = :Series Full 2 << get as matrix;
Code Explanation:
- Open data table.
- Begin data update.
- Create new column from existing.
- Rename new column.
- Move new column.
- Recode values in target column.
- End data update.
- Create tabulate report.
- Convert report to data table.
- Retrieve column data as matrix.
Example 4
Summary: Creates and configures an ordinal model with multiple effects, generating a profiler plot for visualization.
Code:
dt = Open("data_table.jmp");
dt << New Column( "h2", "numeric", "ordinal", width( 5 ), <<Set Formula( :height + 1 ) );
dt:height << Set Modeling Type( "ordinal" );
dt:height << Set Property( "Value Ordering", {51, 52, 55, 56, 59, 58, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70} );
dt:h2 << Set Property( "Value Ordering", {51, 52, 55, 56, 59, 58, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70} );
Tab = dt << Tabulate( Show Control Panel( 0 ), Add Table( Row Table( Columns by Categories( :height, :h2 ) ) ) );
dtTab = Tab << Make into data table();
matrix = dtTab << Get as matrix;
Code Explanation:
- Open data table;
- Create new column h2.
- Set formula for h2.
- Set height modeling type to ordinal.
- Define value ordering for height.
- Define value ordering for h2.
- Create tabulation with height and h2.
- Convert tabulation to data table.
- Extract data as matrix.
Tabulate using Data Filter
Summary: Data filtering and selection by applying multiple conditions to specific columns, then retrieves the filtered rows.
Code:
dt = Open("data_table.jmp");
obj = dt << Data Filter( Add Filter( columns( :BP 8W, :BP 6M ) ), Add Filter( columns( :BP 12M ) ) );
obj << Match( Filter Columns( :BP 8W, :BP 6M ), Where( :BP 8W > 174.8 & :BP 8W < 184.2 ) );
obj << Match( Filter Columns( :BP 12M ), Where( :BP 12M > 181.9 & :BP 12M < 192.1 ) );
obj << Mode( Select( 1 ) );
r = dt << Get Selected Rows();
cert r = [3, 4, 6, 7, 9, 10, 11, 12, 15, 16, 18, 19, 20];
Close( dt, No Save );
Preferences( Tabulate( Save grouping as tags in data table export( 0 ) ) );
Preferences( Tabulate( Scroll Lock row headers in data table export( 0 ) ) );
Code Explanation:
- Open data table;
- Create Data Filter object.
- Add filter for BP 8W and BP 6M.
- Add filter for BP 12M.
- Match BP 8W values between 174.8 and 184.2.
- Match BP 12M values between 181.9 and 192.1.
- Set filter mode to Select.
- Get selected rows.
- Define certified rows list.
- Close table without saving.
Tabulate using Run Script
Summary: Creates a bubble plot and tabulation with progress grouped by direction, followed by row selection and deletion.
Code:
dt = Open("data_table.jmp");
bp = dt << Run Script( "Bubble Plot" );
tab = dt << Tabulate( Add Table( Column Table( Analysis Columns( :Progress ) ), Row Table( Grouping Columns( :Direction ) ) ) );
dt << Select All Rows;
dt << Delete Rows;
Code Explanation:
- Open data table;
- Run "Bubble Plot" script.
- Create tabulation with Progress.
- Group rows by Direction.
- Select all rows.
- Delete selected rows.
Tabulate using Delete File
Summary: Creates a tabulation report with mean height calculations and sex grouping, utilizing JMP's data manipulation capabilities.
Code:
Open( "$TEMP/Output.jrn" );
Delete File( "$TEMP/Output.jrn" );
dt = Open("data_table.jmp");
dtab = dt << Tabulate(
Show Control Panel( 0 ),
Add Table( Column Table( Analysis Columns( :height ), Statistics( Mean ) ), Row Table( Grouping Columns( :sex ) ) )
);
mdt = dtab << Make Into Data Table;
dtab << close window( 1 );
mdt << add rows( 1 );
Column( mdt, "sex" )[3] = "Diff";
Column( mdt, "Mean(height)" )[3] = Column( mdt, "Mean(height)" )[1] - Column( mdt, "Mean(height)" )[2];
vals = Column( mdt, "Mean(height)" ) << get as matrix;
Code Explanation:
- Open a journal file.
- Delete the opened journal file.
- Open data table.
- Create a tabulation report.
- Hide control panel.
- Add column table for height mean.
- Add row table for sex grouping.
- Convert tabulation to data table.
- Close the tabulation window.
- Add a new row to data table.
- Set new row's sex to "Diff".
- Calculate difference in means.
- Store mean heights in a matrix.
Tabulate using New Window
Summary: Creates a tabulate report with grouping columns for sex and marital status, and generates a chart from the report.
Code:
dt = Open("data_table.jmp");
myTab = New Window( "Test", V List Box( tab = Tabulate( Add Table( Row Table( Grouping Column( :sex, :marital status ) ) ) ) ) );
tab << Show Control Panel( 0 );
tab << Show Chart( 1 );
dt2 = tab << Make Into Data Table( 1 );
m = dt2 << Get All Columns As Matrix();
Code Explanation:
- Open data table;
- Create new window named Test.
- Add tabulate report to window.
- Set grouping columns to sex and marital status.
- Hide control panel.
- Show chart.
- Create new data table from report.
- Retrieve all columns as matrix.
Tabulate using Add Table
Summary: Creates and modifies a tabulate object to group data by age, sex, name, and perform statistical analysis on weight and height.
Code:
dt = Open("data_table.jmp");
tab = tabulate( Add Table( row table( grouping columns( :age ) ) ) );
tab << add table( column table( grouping column( :sex ) ) );
tab << modify table( Column table( grouping columns( :sex ) ), Add( after( grouping column( :sex ) ), statistics( mean ) ) );
tab << modify table( Column table( grouping columns( :sex ) ), Add( after( grouping column( :sex ) ), analysis column( :weight ) ) );
tab << modify table( Column table( grouping columns( :sex ) ), Add( before( analysis column( :weight ) ), analysis column( :height ) ) );
tab << add table( row table( grouping column( :name ) ) );
tab << Make into data table;
tabDt2 = Data Table( 1 );
tabDt1 = Data Table( 2 );
Code Explanation:
- Open data table;
- Create tabulate object.
- Add row table grouped by age.
- Add column table grouped by sex.
- Modify table: add mean after sex.
- Modify table: add weight after sex.
- Modify table: add height before weight.
- Add row table grouped by name.
- Convert tabulate to data table.
- Assign data tables to variables.