Column
Example 1
Summary: Sets value labels for the 'sex' column in a JMP data table, enabling the use of these labels for further analysis.
Code:
// Set Sex Value Labels
// Open data table
dt = Open("data_table.jmp");
// Set Sex Value Labels
Column( "sex" ) <<
ValueLabels(
{"M", "F"},
{"Male", "Female"}
);
Column( "sex" ) << UseValueLabels;
Code Explanation:
- Open data table.
- Set Sex value labels.
- Use value labels for sex.
Example 2
Summary: Sets age value labels for a data table column, enabling the use of custom labels in subsequent analyses.
Code:
// Set Age Value Labels
// Open data table
dt = Open("data_table.jmp");
// Set Age Value Labels
Column( "age" ) <<
ValueLabels(
{12, 13, 14, 15, 16, 17},
{"Twelve", "Thirteen", "Fourteen",
"Fifteen", "Sixteen", "Seventeen"}
);
Column( "age" ) << UseValueLabels;
Code Explanation:
- Open data table.
- Set Age Value Labels.
- Define age labels.
- Apply value labels.
- Enable value labels.
Example 3
Summary: Configures specification limits for a column in a JMP data table, setting lower and upper spec limits, target value, and displaying specification limits.
Code:
Open("data_table.jmp");
Column( "Delay" ) << Set Property( "Spec Limits", {LSL( -10 ), USL( 40 ), Target( 15 ), Show Limits( 1 )} );
Code Explanation:
- Open data table;
- Access "Delay" column.
- Set lower spec limit to -10.
- Set upper spec limit to 40.
- Set target value to 15.
- Display specification limits.
Example 4
Summary: Runs the ordering of values in the 'height' column of a data table, utilizing a specific set of ordered values.
Code:
dt = Open("data_table.jmp");
Column( dt, "height" ) << Set Property( "Value Ordering", {51, 52, 55, 56, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70} );
Code Explanation:
- Open data table.
- Set value ordering for height column.
Example 5
Summary: Sets up a data table and sets value order for the 'height' column, preparing it for further analysis.
Code:
dt = Open("data_table.jmp");
Column( dt, "height" ) << Set Property( "Value Order", {51, 52, 55, 56, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70} );
Code Explanation:
- Open data table.
- Set value order for height column.
Example 6
Summary: Runs the setup for multivariate correlations analysis with mahalanobis distances by opening a data table and setting the age column as continuous.
Code:
dt = Open("data_table.jmp");
Column( dt, "age" ) << modeling type( "Continuous" );
Code Explanation:
- Open data table;
- Set age column as continuous.
Example 7
Summary: Runs the specification of limits for a column in a JMP data table, setting LSL to 40, USL to 100, and target value to 70.
Code:
Open("data_table.jmp");
Column( "height" ) << Set Property( "Spec Limits", {LSL( 40 ), USL( 100 ), Target( 70 ), Show Limits( 1 )} );
Code Explanation:
- Open data_table data
- Set spec limits for height column.
- LSL set to 40.
- USL set to 100.
- Target set to 70.
- Show limits enabled.
Example 8
Summary: Sets age column modeling type to continuous and sets values for specific rows to missing.
Code:
dt = Open("data_table.jmp");
Column( dt, "age" ) << set modeling type( "continuous" );
For( i = 38, i <= 40, i++,
Column( dt, "age" )[i] = .
);
Code Explanation:
- Open table.
- Set age as continuous.
- Loop from row 38 to 40.
- Set age values to missing.
Example 9
Summary: Process of performing multivariate correlations analysis with mahalanobis distances on a data table, utilizing JMP's built-in functionality.
Code:
Open("data_table.jmp");
Column( "Landfall in USA" ) << Modeling Type( "Continuous" );
Code Explanation:
- Open data table;
- Set column modeling type.
Example 10
Summary: Formats a 'height' column in a JMP data table as currency with a specified precision and scale.
Code:
Open("data_table.jmp");
Column( "height" ) << Format( "Currency", "USD", 10, 0 );
Code Explanation:
- Open data table;
- Format height column as currency.
Example 11
Summary: Assigns value labels to a specific column in an open data table, defining label ranges and values.
Code:
dt = Open("data_table.jmp");
Column( dt, "height" ) << value labels( {51 <= "below 63" <= 63} );
Code Explanation:
- Open data table.
- Assign table to variable
dt. - Access "height" column.
- Apply value labels to "height".
- Define label range for values.
- Label values below 63.
- Label values equal to 63.
Example 12
Summary: Runs the renaming and labeling of a column in a JMP data table, allowing for interactive filtering by gender.
Code:
dt = Open("data_table.jmp");
col = Column( dt, "sex" );
col << Set Name( "gender with Value Labels" );
col << Value Labels( {"F" = "Females", "M" = "Males"} );
col << Use Value Labels( 1 );
Code Explanation:
- Open table.
- Assign column.
- Rename column.
- Set value labels.
- Enable value labels.
Example 13
Summary: Formats sales and employees columns in a JMP data table, using thousands separators for improved readability.
Code:
dt = Open("data_table.jmp");
Column( "sales($M)" ) << Format( "use thousands separator" );
Column( "#employees" ) << Format( "use thousands separator" );
Code Explanation:
- Open data table.
- Format sales column.
- Format employees column.
Example 14
Summary: Selects and deletes specific rows in a data table, utilizing the Recode option to modify column settings.
Code:
dt2 = Open("data_table.jmp");
Column( "weight" ) << Set Selected;
Main Menu( "Cols:Recode" );
dt2 << Select Rows( [5, 6] );
dt2 << Delete rows();
Code Explanation:
- Open data table.
- Select weight column.
- Access Recode option.
- Select specific rows.
- Delete selected rows.
Example 15
Summary: Selects and excludes rows in a JMP data table, utilizing the Main Menu to access recoding options.
Code:
dt3 = Open("data_table.jmp");
Column( "weight" ) << Set Selected;
Main Menu( "Cols:Recode" );
dt3 << Select Rows( [5, 6] );
dt3 << Exclude();
dt3 << Select Rows( [10, 11] );
dt3 << Hide();
Code Explanation:
- Open data table.
- Select weight column.
- Access recode menu.
- Select rows 5 and 6.
- Exclude selected rows.
- Select rows 10 and 11.
- Hide selected rows.
Example 16
Summary: Runs the selection and recoding of a specific column in a JMP data table, allowing for further analysis.
Code:
dt = Open("data_table.jmp");
Column( "weight" ) << Set Selected;
Main Menu( "Cols:Recode" );
Code Explanation:
- Open data table.
- Select weight column.
- Access Columns menu.
- Choose Recode option.
Example 17
Summary: Excludes specific columns from a data table, retrieving the excluded column list for further analysis.
Code:
dt = Open("data_table.jmp");
Column( dt, "Turning Circle" ) << Exclude( 1 );
Column( dt, "Type" ) << Exclude( 1 );
Column( dt, "Model" ) << Exclude( 1 );
act excluded = dt << Get Excluded Columns;
excludeList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( excludeList, Column( i ) << Get Excluded )
);
Code Explanation:
- Open data table.
- Exclude first row from "Turning Circle".
- Exclude first row from "Type".
- Exclude first row from "Model".
- Retrieve excluded columns.
- Initialize empty exclude list.
- Loop through all columns.
- Insert exclusion status into list.
- End loop.
Example 18
Summary: Runs the labeling and retrieval of columns in a JMP data table, utilizing the Get Labeled Columns function.
Code:
dt = Open("data_table.jmp");
Column( dt, "Turning Circle" ) << Label( 1 );
Column( dt, "Type" ) << Label( 1 );
Column( dt, "Model" ) << Label( 1 );
act labelled = dt << Get Labeled Columns;
act labeled = dt << Get Labeled Columns;
labelList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( labelList, Column( i ) << Get Labelled )
);
Code Explanation:
- Open data table.
- Label "Turning Circle".
- Label "Type".
- Label "Model".
- Retrieve labeled columns.
- Retrieve labeled columns again.
- Initialize label list.
- Loop through all columns.
- Get column labels.
- Insert labels into list.
Example 19
Summary: Selects and retrieves specific columns from a data table, providing a list of selected columns for further analysis.
Code:
dt = Open("data_table.jmp");
Column( dt, "Turning Circle" ) << Set Selected;
Column( dt, "Type" ) << Set Selected;
Column( dt, "Model" ) << Set Selected;
act selected = dt << Get selected Columns;
selectList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( selectList, Column( i ) << Get selected )
);
Code Explanation:
- Open data table.
- Select "Turning Circle" column.
- Select "Type" column.
- Select "Model" column.
- Get selected columns.
- Initialize selection list.
- Loop through all columns.
- Check each column's selection status.
- Insert selection status into list.
- End loop.
Example 20
Summary: Locks and retrieves specific columns in a JMP data table, allowing for interactive filtering and analysis.
Code:
dt = Open("data_table.jmp");
Column( dt, "Turning Circle" ) << Scroll Lock( 1 );
Column( dt, "Type" ) << Scroll Lock( 1 );
Column( dt, "Model" ) << Scroll Lock( 1 );
act scrolled = dt << Get Scroll Locked Columns;
scrollList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( scrollList, Column( i ) << Get Scroll Locked )
);
Code Explanation:
- Open table.
- Lock "Turning Circle" column.
- Lock "Type" column.
- Lock "Model" column.
- Get locked columns.
- Initialize scrollList.
- Loop through columns.
- Check each column's lock state.
- Add lock states to scrollList.
- End loop.
Example 21
Summary: Hides and unhides specific columns in a JMP data table, allowing for dynamic column management.
Code:
dt = Open("data_table.jmp");
Column( dt, "brand" ) << set Hidden( 1 );
Column( dt, "softness" ) << set Hidden( 1 );
Column( dt, "previous use" ) << set Hidden( 1 );
act hidden = dt << Get Hidden Columns;
hideList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( hideList, Column( i ) << Get Hidden )
);
Column( dt, "brand" ) << set Hidden( 0 );
Column( dt, "softness" ) << set Hidden( 0 );
Column( dt, "previous use" ) << set Hidden( 0 );
act hidden = dt << Get Hidden Columns;
hideList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( hideList, Column( i ) << Get Hidden )
);
Code Explanation:
- Open data table.
- Hide "brand" column.
- Hide "softness" column.
- Hide "previous use" column.
- Get list of hidden columns.
- Initialize empty list hideList.
- Loop through all columns.
- Insert hidden status into hideList.
- Unhide "brand" column.
- Unhide "softness" column.
- Unhide "previous use" column.
- Get updated list of hidden columns.
- Reinitialize empty list hideList.
- Loop through all columns again.
- Insert updated hidden status into hideList.
Example 22
Summary: Runs the exclusion and re-inclusion of specific columns in a JMP data table, allowing for dynamic management of column visibility.
Code:
dt = Open("data_table.jmp");
Column( dt, "brand" ) << set excluded( 1 );
Column( dt, "softness" ) << set excluded( 1 );
Column( dt, "previous use" ) << set excluded( 1 );
act excluded = dt << Get excluded Columns;
excludedList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( excludedList, Column( i ) << Get excluded )
);
Column( dt, "brand" ) << set excluded( 0 );
Column( dt, "softness" ) << set excluded( 0 );
Column( dt, "previous use" ) << set excluded( 0 );
act excluded = dt << Get excluded Columns;
excludedList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( excludedList, Column( i ) << Get excluded )
);
Code Explanation:
- Open data_table data
- Exclude "brand" column.
- Exclude "softness" column.
- Exclude "previous use" column.
- Retrieve excluded columns.
- Initialize empty list.
- Loop through all columns.
- Insert exclusion status into list.
- Include "brand" column again.
- Include "softness" column again.
- Include "previous use" column again.
- Retrieve excluded columns.
- Reinitialize empty list.
- Loop through all columns.
- Insert exclusion status into list.
Example 23
Summary: Runs the labelling and unlabelling of specific columns in a JMP data table, allowing for dynamic manipulation of column properties.
Code:
dt = Open("data_table.jmp");
Column( dt, "brand" ) << set Labelled( 1 );
Column( dt, "softness" ) << setLabelled( 1 );
Column( dt, "previous use" ) << set Labelled( 1 );
act Labelled = dt << Get Labeled Columns;
LabelledList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( LabelledList, Column( i ) << Get Labelled )
);
Column( dt, "brand" ) << set Labelled( 0 );
Column( dt, "softness" ) << set Labelled( 0 );
Column( dt, "previous use" ) << set Labelled( 0 );
act Labelled = dt << Get Labeled Columns;
LabelledList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( LabelledList, Column( i ) << Get Labelled )
);
Code Explanation:
- Open data table;
- Set "brand" column as labelled.
- Set "softness" column as labelled.
- Set "previous use" column as labelled.
- Retrieve labelled columns.
- Initialize empty list for labels.
- Loop through all columns.
- Add labelled status to list.
- Unset "brand" column as labelled.
- Unset "softness" column as labelled.
- Unset "previous use" column as labelled.
- Retrieve labelled columns again.
- Reinitialize empty list for labels.
- Loop through all columns again.
- Add labelled status to list.
Example 24
Summary: Runs the selection and deselection of specific columns in a JMP data table, updating the SelectedList accordingly.
Code:
dt = Open("data_table.jmp");
Column( dt, "brand" ) << set Selected( 1 );
Column( dt, "softness" ) << set Selected( 1 );
Column( dt, "previous use" ) << set Selected( 1 );
act selected = dt << Get Selected Columns;
SelectedList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( SelectedList, Column( i ) << Get Selected )
);
Column( dt, "brand" ) << set Selected( 0 );
Column( dt, "softness" ) << set Selected( 0 );
Column( dt, "previous use" ) << set Selected( 0 );
act Selected = dt << Get Selected Columns;
SelectedList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( SelectedList, Column( i ) << Get Selected )
);
Code Explanation:
- Open data table;
- Select "brand" column.
- Select "softness" column.
- Select "previous use" column.
- Retrieve selected columns.
- Initialize SelectedList.
- Loop through all columns.
- Add selection status to SelectedList.
- Unselect "brand" column.
- Unselect "softness" column.
- Unselect "previous use" column.
- Retrieve selected columns again.
- Reinitialize SelectedList.
- Loop through all columns again.
- Add updated selection status to SelectedList.
Example 25
Summary: Locks and unlocks scroll functionality for specific columns in a JMP data table, allowing for dynamic control over column visibility.
Code:
dt = Open("data_table.jmp");
Column( dt, "brand" ) << set scroll locked( 1 );
Column( dt, "softness" ) << set scroll locked( 1 );
Column( dt, "previous use" ) << set scroll locked( 1 );
act scroll locked = dt << Get scroll locked Columns;
scrollList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( scrollList, Column( i ) << Get scroll locked )
);
Column( dt, "brand" ) << set scroll locked( 0 );
Column( dt, "softness" ) << set scroll locked( 0 );
Column( dt, "previous use" ) << set scroll locked( 0 );
act scroll locked = dt << Get scroll locked Columns;
scrollList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( scrollList, Column( i ) << Get scroll locked )
);
Code Explanation:
- Open data_table data
- Lock scroll for "brand" column.
- Lock scroll for "softness" column.
- Lock scroll for "previous use" column.
- Retrieve locked columns.
- Initialize empty scrollList.
- Loop through all columns.
- Add scroll lock status to scrollList.
- Unlock scroll for "brand" column.
- Unlock scroll for "softness" column.
- Unlock scroll for "previous use" column.
- Retrieve locked columns again.
- Reinitialize empty scrollList.
- Loop through all columns again.
- Add updated scroll lock status to scrollList.
Example 26
Summary: Manages scroll locks for specific columns in a JMP data table, allowing for dynamic control over column visibility and interaction.
Code:
dt = Open("data_table.jmp");
Column( "name" ) << Set Hidden( 1 );
Column( "age" ) << Scroll Lock( 1 );
Column( "sex" ) << Scroll Lock( 1 );
Column( "name" ) << Scroll Lock( 1 );
act scroll locked = dt << Get scroll locked Columns;
scrollList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( scrollList, Column( i ) << Get scroll locked )
);
Column( "name" ) << Scroll Lock( 0 );
Column( "age" ) << Scroll Lock( 0 );
Column( "sex" ) << Scroll Lock( 0 );
Column( "name" ) << Scroll Lock( 0 );
act scroll locked = dt << Get scroll locked Columns;
scrollList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( scrollList, Column( i ) << Get scroll locked )
);
Code Explanation:
- Open data table.
- Hide "name" column.
- Lock "age" column scroll.
- Lock "sex" column scroll.
- Lock "name" column scroll again.
- Get scroll-locked columns.
- Initialize scrollList.
- Loop through all columns.
- Add scroll lock status to scrollList.
- Unlock "name" column scroll four times.
- Unlock "age" column scroll.
- Unlock "sex" column scroll.
- Get scroll-locked columns again.
- Initialize scrollList again.
- Loop through all columns.
- Add scroll lock status to scrollList.
Example 27
Summary: Hides and unhides specific columns in a JMP data table, allowing for dynamic column management.
Code:
dt = Open("data_table.jmp");
Column( "name" ) << hide( 1 );
Column( "age" ) << hide( 1 );
Column( "sex" ) << hide( 1 );
Column( "name" ) << hide( 1 );
act hide = dt << Get hidden Columns;
hideList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( hideList, Column( i ) << Get hidden )
);
Column( "name" ) << hide( 0 );
Column( "age" ) << hide( 0 );
Column( "sex" ) << hide( 0 );
Column( "name" ) << hide( 0 );
act hide = dt << Get hidden Columns;
hideList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( hideList, Column( i ) << Get hidden )
);
Code Explanation:
- Open data table.
- Hide "name" column.
- Hide "age" column.
- Hide "sex" column.
- Hide "name" column again.
- Get hidden columns list.
- Initialize empty list.
- Loop through all columns.
- Add hidden status to list.
- Unhide "name" column.
- Unhide "age" column.
- Unhide "sex" column.
- Unhide "name" column again.
- Get hidden columns list.
- Initialize empty list.
- Loop through all columns.
- Add hidden status to list.
Example 28
Summary: Runs the labeling and unlabeled process for specific columns in a JMP data table, utilizing loops to track labeled status.
Code:
dt = Open("data_table.jmp");
Column( "name" ) << Label( 1 );
Column( "age" ) << Label( 1 );
Column( "sex" ) << Label( 1 );
Column( "name" ) << Label( 1 );
act Label = dt << Get labeled Columns;
LabelList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( LabelList, Column( i ) << Get labelled )
);
Column( "name" ) << Label( 0 );
Column( "age" ) << Label( 0 );
Column( "sex" ) << Label( 0 );
Column( "name" ) << Label( 0 );
act Label = dt << Get labeled Columns;
LabelList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( LabelList, Column( i ) << Get Labelled )
);
Code Explanation:
- Open data table.
- Label "name" column.
- Label "age" column.
- Label "sex" column.
- Get labeled columns.
- Initialize empty list.
- Loop through all columns.
- Insert labeled status into list.
- Unlabel "name" column.
- Unlabel "age" column.
- Unlabel "sex" column.
- Unlabel "name" column.
- Get labeled columns again.
- Initialize empty list.
- Loop through all columns.
- Insert labeled status into list.
Example 29
Summary: Runs the exclusion and re-inclusion of specific columns in a JMP data table, allowing for dynamic management of column visibility.
Code:
dt = Open("data_table.jmp");
Column( "name" ) << Exclude( 1 );
Column( "age" ) << Exclude( 1 );
Column( "sex" ) << Exclude( 1 );
Column( "name" ) << Exclude( 1 );
act Exclude = dt << Get excluded Columns;
ExcludeList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( ExcludeList, Column( i ) << Get excluded )
);
Column( "name" ) << Exclude( 0 );
Column( "age" ) << Exclude( 0 );
Column( "sex" ) << Exclude( 0 );
Column( "name" ) << Exclude( 0 );
act Exclude = dt << Get excluded Columns;
ExcludeList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( ExcludeList, Column( i ) << Get excluded )
);
Code Explanation:
- Open data table;
- Exclude first row from "name".
- Exclude first row from "age".
- Exclude first row from "sex".
- Exclude first row from "name".
- Get excluded columns.
- Initialize ExcludeList.
- Loop through all columns.
- Insert exclusion status into ExcludeList.
- Unexclude first row from "name".
- Unexclude first row from "age".
- Unexclude first row from "sex".
- Unexclude first row from "name".
- Get excluded columns again.
- Reinitialize ExcludeList.
- Loop through all columns again.
- Insert new exclusion status into ExcludeList.
Example 30
Summary: Runs column management and selection for data exploration, including labeling, hiding, excluding, and locking columns in a JMP data table.
Code:
dt = Open("data_table.jmp");
Column( dt, "name" ) << Set Labelled << Set Excluded;
Column( dt, "sex" ) << Set Labelled << Set Hidden;
Column( dt, "age" ) << Set Hidden << Set Excluded;
Column( dt, "oxy" ) << Set selected << set scroll locked;
Column( dt, "weight" ) << set selected << set scroll locked << set excluded << set hidden < set labelled;
act label = dt << Get Labeled Columns;
act select = dt << Get Selected Columns;
act hide = dt << Get hidden columns;
act exclude = dt << get excluded columns;
act scroll = dt << get scroll locked columns;
Code Explanation:
- Open data table;
- Label "name" column.
- Exclude "name" column.
- Label "sex" column.
- Hide "sex" column.
- Hide "age" column.
- Exclude "age" column.
- Select "oxy" column.
- Lock "oxy" column scrolling.
- Select "weight" column.
- Lock "weight" column scrolling.
- Exclude "weight" column.
- Hide "weight" column.
- Label "weight" column.
- Retrieve labeled columns.
- Retrieve selected columns.
- Retrieve hidden columns.
- Retrieve excluded columns.
- Retrieve scroll-locked columns.
Example 31
Summary: Configures a custom value ordering and list check for the 'age' column in a JMP data table.
Code:
dt = Open("data_table.jmp");
Column( "age" ) << Get Property( "Aliases" );
Column( "age" ) << Add Column Properties( Set Property( Value Ordering, {17, 16, 15, 14, 13, 12} ) );
:Age << Add Column Properties( List Check( {17, 16, 15, 14, 13, 12} ) );
Code Explanation:
- Open table.
- Get column property.
- Set value ordering.
- Add list check.
Example 32
Summary: Configures a profit matrix property for a data table column, allowing for conditional formatting and decision-making based on specific criteria.
Code:
dt = Open("data_table.jmp");
Column( dt, "Banding?" ) << Set Property( "Profit Matrix", {[1 - 3, -1 2, . .], {"band", "noband", "Undecided"}} );
prop = Column( dt, "Banding?" ) << Get Property( "Profit Matrix" );
Code Explanation:
- Open table.
- Set profit matrix property.
- Retrieve profit matrix property.
Example 33
Summary: Runs property setting operations on a JMP data table column, demonstrating various syntax and error handling scenarios.
Code:
dt = Open("data_table.jmp");
dc = Column( dt, "age" );
dc << Set Property( Any, Eval(), Any );
Try( dc << Set Property() );
dc << Set Property( [] );
dc << Set Property( {} );
dc << Set Property( foo, foo );
dc << Set Property( "", {} );
dc << Set Property( Eval() );
Code Explanation:
- Open data table;
- Access "age" column.
- Set property using Any.
- Attempt setting property without arguments.
- Set property using empty list.
- Set property using empty dictionary.
- Set property using "foo".
- Set property using empty string and dictionary.
- Set property using Eval().
Example 34
Summary: Runs data table operations to set color properties, apply color coding, select all rows, and delete selected rows.
Code:
dt = Open("data_table.jmp");
Column( "season" ) << Set Property( "Value Colors", {"fall" = -13977687, "spring" = -3780931, "summer" = -4222943, "winter" = -13596966} );
Column( "season" ) << Color Cell by Value;
dt << Select All Rows;
dt << Delete Rows;
Code Explanation:
- Open data table;
- Define color properties for "season".
- Apply color coding to "season" column.
- Select all rows in table.
- Delete all selected rows.
Example 35
Summary: Runs the reorganization and selection of columns in a JMP data table, grouping and rearranging variables for analysis.
Code:
dt = Open("data_table.jmp");
dt << group columns( "xy", {:X, :Y} );
dt << group columns( "pollutants", :Ozone :: :Lead );
dt << group columns( "location", :Latitude :: :Longitude );
dt << move column group( after( Column( "State" ) ), "location" );
dt << move column group( after( xy ), "location" );
dt << move column group( after( State ), "location" );
dt << move column group( after( State ), "xy" );
dt << move column group( after( :State ), "location" );
dt << Select Column Group( "location" );
dt << Move Selected Columns( after( "State" ) );
dt << Select Column Group( "location" );
dt << Move Selected Columns( after( "city" ) );
dt << Clear column selection;
dt << Select Column Group( "pollutants" );
dt << Move Column Group( "pollutants", After( "xy" ) );
Code Explanation:
- Open data table.
- Group columns X and Y as "xy".
- Group columns Ozone to Lead as "pollutants".
- Group columns Latitude and Longitude as "location".
- Move "location" after "State".
- Move "location" after "xy".
- Move "location" after "State".
- Move "xy" after "State".
- Move "location" after "State".
- Select "location" group.
- Move "location" after "State".
- Select "location" group.
- Move "location" after "city".
- Clear column selection.
- Select "pollutants" group.
- Move "pollutants" after "xy".
Example 36
Summary: Creates a new column with properties copied from an existing column, demonstrating data manipulation and property inheritance in JMP.
Code:
dt = Open("data_table.jmp");
c = Column( 5 );
p = c << get column properties();
c2 = New Column( "New Col" );
c2 << add column properties( p );
p2 = c2 << get column properties();
Code Explanation:
- Open data table.
- Select fifth column.
- Retrieve column properties.
- Create new column.
- Add retrieved properties to new column.
- Retrieve properties of new column.
Example 37
Summary: Runs data table operations, including column deletion and selection, to prepare the dataset for further analysis.
Code:
dt = Open("data_table.jmp");
dt << delete columns( "age" );
Column( "height" ) << set selected;
dt << delete column();
colNames = dt << Get Column Names;
Code Explanation:
- Open data table;
- Delete "age" column.
- Select "height" column.
- Delete selected column.
- Retrieve remaining column names.
Example 38
Summary: Process of setting and retrieving the field width of a column in a JMP data table.
Code:
dt = Open("data_table.jmp");
ncol = Column( "weight" );
ncol << set field width( 2 );
fw = ncol << Get Field Width;
Code Explanation:
- Open data table.
- Assign weight column to variable.
- Set field width of weight column.
- Retrieve field width of weight column.
Example 39
Summary: Retrieves the first value from the 'age' column in a data table, assigning it to the variable 'firstval'.
Code:
dtp = Open( "$SAMPLE_DATA/data_table.jmp", private );
firstval = Column( dtp, "age" )[1];
Code Explanation:
- Open data table.
- Assign table to
dtp. - Retrieve first value from "age" column.
- Assign value to
firstval.
Example 40
Summary: Retrieves a value from column 4, row 2 in a data table.
Code:
dt = Open("data_table.jmp");
var = "";
var = Column( dt, 4 )[2];
Code Explanation:
- Open data table;
- Initialize variable
var. - Assign value from column 4, row 2.
Example 41
Summary: Extracts a specific column value from an open data table, utilizing Column() function.
Code:
dt = Open("data_table.jmp");
var = "";
var = Column(dt, Column Name( 4 ))[2];
Code Explanation:
- Open data table;
- Initialize variable var as empty string.
- Assign second value of fourth column to var.
Example 42
Summary: Opens a data table and assigns a column reference for multivariate correlations analysis.
Code:
dt = Open("data_table.jmp");
col = Column( dt, "name" );
Code Explanation:
- Open data table.
- Assign column reference.
Example 43
Summary: Creates a marker segment graph to visualize height and age data, utilizing the Get Values and New Window functions in JMP.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", invisible );
xx = Column( "height" ) << Get Values;
aa = [=> 0];
sz = Column( "age" ) << get values;
yy = J( N Rows( xx ), 1, 0 );
For( ii = 1, ii <= N Rows( xx ), ii++,
aa[xx[ii]]++;
yy[ii] = aa[xx[ii]];
);
nw15 = New Window( "Marker Seg Example",
g = Graph Box(
Frame Size( 300, 120 ),
X Scale( Min( xx ) - 5, Max( xx ) + 5 ),
Y Scale( 0, 10 ),
Marker Seg( xx, yy, Row States( dt ), Sizes( sz ) )
)
);
frame = g[FrameBox( 1 )];
seg = (frame << Find Seg( "Marker Seg" ));
seg << Set Transparency( 0.3 );
nw15 << Close Window;
dt << Close Window;
Code Explanation:
- Open data table;
- Extract height values.
- Initialize count array.
- Extract age values.
- Initialize marker array.
- Loop through each row.
- Increment count for height.
- Assign count to marker array.
- Create new window.
- Add graph box.
- Set frame size.
- Define x-axis scale.
- Define y-axis scale.
- Add marker segment.
- Access frame box.
- Find marker segment.
- Set transparency.
- Close new window.
- Close dataset window.
Example 44
Summary: Creates a graph with marker segments to visualize height and age data, utilizing the Get Values and New Window functions.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", invisible );
xx = Column( "height" ) << Get Values;
aa = [=> 0];
sz = Column( "age" ) << get values;
yy = J( N Rows( xx ), 1, 0 );
For( ii = 1, ii <= N Rows( xx ), ii++,
aa[xx[ii]]++;
yy[ii] = aa[xx[ii]];
);
nw16 = New Window( "Marker Seg Example",
g = Graph Box(
Frame Size( 300, 120 ),
X Scale( Min( xx ) - 5, Max( xx ) + 5 ),
Y Scale( 0, 10 ),
Marker Seg( xx, yy, Row States( dt ), Sizes( sz ) )
)
);
frame = g[FrameBox( 1 )];
seg = (frame << Find Seg( "Marker Seg" ));
seg << Set Transparency( 0.9 );
gt = seg << Get Transparency;
nw16 << Close Window;
dt << Close Window;
Code Explanation:
- Open data table.
- Extract height column values.
- Initialize age count array.
- Extract age column values.
- Create zero vector for yy.
- Loop through each row.
- Increment age count.
- Assign count to yy.
- Create new window for graph.
- Add graph box with marker segments.
- Adjust frame size and scales.
- Plot marker segments.
- Find marker segment in frame.
- Set transparency to 0.9.
- Retrieve transparency value.
- Close graph window.
- Close data table window.
Example 45
Summary: Creates a marker segment plot with sizes based on age values, utilizing the
Marker Segfunction in JMP.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", invisible );
xx = Column( "height" ) << Get Values;
aa = [=> 0];
sz = Column( "age" ) << get values;
yy = J( N Rows( xx ), 1, 0 );
For( ii = 1, ii <= N Rows( xx ), ii++,
aa[xx[ii]]++;
yy[ii] = aa[xx[ii]];
);
nw25 = New Window( "Marker Seg Example",
g = Graph Box(
Frame Size( 300, 120 ),
X Scale( Min( xx ) - 5, Max( xx ) + 5 ),
Y Scale( 0, 10 ),
Marker Seg( xx, yy, Row States( dt ), Sizes( sz ) )
)
);
frame = g[FrameBox( 1 )];
seg = (frame << Find Seg( "Marker Seg" ));
class_name = seg << Class Name;
nw25 << Close Window;
dt << Close Window;
Code Explanation:
- Open data table;
- Retrieve height column values.
- Initialize array
aa. - Retrieve age column values.
- Create zero-filled array
yy. - Loop through each row.
- Increment count for each height.
- Assign count to
yyarray. - Create new window "Marker Seg Example".
- Add graph box with marker segment plot.
- Adjust frame size and scales.
- Plot marker segments with sizes.
- Get frame box from graph.
- Find marker segment element.
- Retrieve class name.
- Close the new window.
- Close the data table.
Example 46
Summary: Vizualizes marker segments in a graph box, utilizing color and marker themes to highlight age groups.
Code:
dt = Open("data_table.jmp");
dt << color or mark by column( :age, color theme( "pastel" ), marker theme( "alphanumeric" ) );
xx = Column( "height" ) << Get Values;
aa = [=> 0];
sz = Column( "age" ) << get values;
yy = J( N Rows( xx ), 1, 0 );
For( ii = 1, ii <= N Rows( xx ), ii++,
aa[xx[ii]]++;
yy[ii] = aa[xx[ii]];
);
nw33 = New Window( "Marker Seg Example",
g = Graph Box(
Frame Size( 300, 120 ),
X Scale( Min( xx ) - 5, Max( xx ) + 5 ),
Y Scale( 0, 10 ),
Marker Seg( xx, yy, Row States( dt ), Sizes( sz ) )
)
);
frame = g[FrameBox( 1 )];
seg = (frame << Find Seg( "Marker Seg" ));
rsColors = seg << get colors;
nw33 << Close Window;
Code Explanation:
- Open data table;
- Color/mark by age column.
- Retrieve height values.
- Initialize age array.
- Retrieve age values.
- Initialize yy array.
- Loop through each row.
- Increment age count.
- Assign yy value.
- Create new window with graph box.
Example 47
Summary: Creates a graph window to visualize marker segments based on height and age data, utilizing JSL scripting language.
Code:
dt = Open("data_table.jmp");
xx = Column( "height" ) << Get Values;
aa = [=> 0];
sz = Column( "age" ) << get values;
yy = J( N Rows( xx ), 1, 0 );
For( ii = 1, ii <= N Rows( xx ), ii++,
aa[xx[ii]]++;
yy[ii] = aa[xx[ii]];
);
win = New Window( "Marker Seg Example",
g = Graph Box(
Frame Size( 300, 120 ),
X Scale( Min( xx ) - 5, Max( xx ) + 5 ),
Y Scale( 0, 10 ),
Marker Seg( xx, yy, Row States( dt ) )
)
);
frame = g[FrameBox( 1 )];
seg = (frame << Find Seg( Marker Seg( 1 ) ));
seg << color( RGB Color( 190, 190, 80 ) );
seg << color( 3 );
win << Close Window;
Code Explanation:
- Open data table.
- Retrieve height column values.
- Initialize age count array.
- Retrieve age column values.
- Create zero-filled result array.
- Loop through each row.
- Increment age count for height.
- Assign count to result array.
- Create new window for graph.
- Close the graph window.
Example 48
Summary: Creates a marker segment graph to visualize height and age data, utilizing the Get Values and New Window functions in JMP.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", invisible );
xx = Column( "height" ) << Get Values;
aa = [=> 0];
sz = Column( "age" ) << get values;
yy = J( N Rows( xx ), 1, 0 );
For( ii = 1, ii <= N Rows( xx ), ii++,
aa[xx[ii]]++;
yy[ii] = aa[xx[ii]];
);
nw26 = New Window( "Marker Seg Example",
g = Graph Box(
Frame Size( 300, 120 ),
X Scale( Min( xx ) - 5, Max( xx ) + 5 ),
Y Scale( 0, 10 ),
Marker Seg( xx, yy, Row States( dt ), Sizes( sz ) )
)
);
frame = g[FrameBox( 1 )];
seg = (frame << Find Seg( "Marker Seg" ));
seg << Delete;
nw26 << Close Window;
Code Explanation:
- Open data table.
- Retrieve height column values.
- Initialize age array.
- Get age column values.
- Create zero-filled result array.
- Loop through each row.
- Increment age count.
- Assign count to result array.
- Create new window.
- Add graph box with marker segments.
- Locate frame box.
- Find marker segment.
- Delete marker segment.
- Close window.
Example 49
Summary: Process of setting a column to nominal modeling type, allowing for further analysis and visualization in JMP.
Code:
dt1 = Open("data_table.jmp");
Column( dt1, "Price" ) << Modeling Type( Nominal );
Code Explanation:
- Open data table;
- Set "Price" column to nominal.
Example 50
Summary: Modifies a data table by setting the value of the second column to 1.
Code:
dt = Open("data_table.jmp");
Column( dt, 2 )[1] = 1;
Code Explanation:
- Open data table.
- Modify second column value.
New Column
Example 1
Summary: Calculates the loss function template for an Exponential model, incorporating conditional logic and parameter estimation.
Code:
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// JSL to create a loss function template of Exponenential //
///////////////////////////////////////////////////////////////////////////////////////////////////////////
dt= new table ("Exponential");
dt<<New Column("Time", Numeric,continuous);
dt<<New Column("Censor", Numeric,continuous);
dt<<New Column("Exponential", Numeric,continuous);
col=column( "Exponential");
col<<formula( Parameter({sigma=28703.3328183542}, -IfMZ( :Censor==0, (-Log(sigma))- :Time/sigma, -( :Time/sigma))) );
Code Explanation:
- Create new table named "Exponential".
- Add column "Time" to table.
- Add column "Censor" to table.
- Add column "Exponential" to table.
- Assign "Exponential" column to variable
col. - Define formula for "Exponential" column.
- Set initial value for parameter sigma.
- Use IfMZ function for conditional logic.
- Calculate negative log of sigma if Censor equals 0.
- Calculate negative time divided by sigma otherwise.
Example 2
Summary: Calculates the loss function template for Extreme Value Theory, utilizing conditional logic and mathematical expressions to model censoring effects.
Code:
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// JSL to create a loss function template of Extreme value //
///////////////////////////////////////////////////////////////////////////////////////////////////////////
dt= new table ("Extreme value");
dt<<New Column("Time", Numeric,continuous);
dt<<New Column("Censor", Numeric,continuous);
dt<<New Column("Extreme value", Numeric,continuous);
col=column( "Extreme value");
col<<formula( Parameter({lambda=3.26944897591195, delta=0.94478144505066}, -IfMZ( :Censor==0, ((-Log(delta))-Exp((Log( :Time/100)-lambda)/delta))+(Log( :Time)/100-lambda)/delta, -Exp((Log( :Time/100)-lambda)/delta))) );
Code Explanation:
- Create new table.
- Name table "Extreme value".
- Add "Time" column.
- Add "Censor" column.
- Add "Extreme value" column.
- Reference "Extreme value" column.
- Define formula for column.
- Use parameters lambda and delta.
- Apply conditional logic based on Censor.
- Calculate log and exponential expressions.
Example 3
Summary: Creates a loss function template for LogLogistic regression, defining formulas for the 'Model' and 'LogLogistic Loss' columns in a new table.
Code:
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// JSL to create a loss function template of LogLogistic //
///////////////////////////////////////////////////////////////////////////////////////////////////////////
dt= new table ("LogLogistic");
dt<<New Column("Time", Numeric,continuous);
dt<<New Column("Censor", Numeric,continuous);
dt<<New Column("Model", Numeric,continuous);
dt<<New Column("LogLogistic Loss", Numeric,continuous);
column( "Model") << formula( Parameter({b0=-11.8912196204114, b1=9.03834026782309}, Log( :Time)-(b0+b1*Empty())) );
column( "LogLogistic Loss") << formula( Parameter({sigma=0.5}, -IfMZ( :censor==0, :Model/sigma-2*Log(1+Exp( :Model/sigma))-Log(sigma), -Log(1+Exp( :Model/sigma)))) );
Code Explanation:
- Create new table "LogLogistic".
- Add column "Time" as numeric continuous.
- Add column "Censor" as numeric continuous.
- Add column "Model" as numeric continuous.
- Add column "LogLogistic Loss" as numeric continuous.
- Define "Model" formula with parameters b0, b1.
- Define "LogLogistic Loss" formula with parameter sigma.
- Use IfMZ function for conditional calculation.
Example 4
Summary: Creates a loss function template for Weibull distribution with one parameter, defining the 'Model' and 'Weibull' columns based on the provided formulae.
Code:
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// JSL to create a loss function template of Weibull, 1 Parm //
///////////////////////////////////////////////////////////////////////////////////////////////////////////
dt= new table ("Weibull, 1 Parm");
dt<<New Column("Censor", Numeric,continuous);
dt<<New Column("Model", Numeric,continuous);
dt<<New Column("Weibull", Numeric,continuous);
column( "Model") << formula( Parameter({b0=3.93988152926993, b1=0.004505313558698, b2=-0.01244813868867}, Log(Empty())-(b0+b1*Empty()+b2*Empty())) );
column( "Weibull") << formula( Parameter({sigma=0.928115276636918}, -IfMZ( :Censor==0, :Model/sigma-Exp( :Model/sigma)-Log(sigma), -Exp( :Model/sigma))) );
Code Explanation:
- Create new table.
- Name table "Weibull, 1 Parm".
- Add "Censor" column.
- Add "Model" column.
- Add "Weibull" column.
- Define "Model" column formula.
- Define "Weibull" column formula.
Example 5
Summary: Creates a Weibull distribution with two parameters (Alpha and Beta) in JMP, incorporating censoring and calculating the log-likelihood for censored data.
Code:
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// JSL to create a loss function template of Weibull, 2 Parm //
///////////////////////////////////////////////////////////////////////////////////////////////////////////
dt= new table ("Weibull, 2 Parm");
dt<<set table variable("Notes","Nelson (1982) suggests \!"Good starting values for this Weibull are: ... use the 63.2th quartile of Time as a starting value for alpha and something between .5 and 5 for beta.\!" Use Distribution of Y on time and Save Prob Scores to get quartiles for Time.");
dt<<New Column("Time", Numeric,continuous);
dt<<New Column("Censor", Numeric,continuous);
dt<<New Column("Weibull", Numeric,continuous);
column( "Weibull") << formula( Parameter({Alpha=26296.8172051511, Beta=1.0584462447544}, -IfMZ( :Censor!=0, -Exp(Beta*Log( :Time/Alpha)), ((Log(Beta)+(Beta-1)*Log( :Time))-Beta*Log(Alpha))+(-Exp(Beta*Log( :Time/Alpha))))) );
Code Explanation:
- Create new table named "Weibull, 2 Parm".
- Set table variable "Notes" with Nelson's suggestion.
- Add column "Time" as numeric continuous.
- Add column "Censor" as numeric continuous.
- Add column "Weibull" as numeric continuous.
- Define formula for "Weibull" column.
- Use parameters Alpha and Beta.
- Apply IfMZ condition for censoring.
- Calculate exponential term for uncensored data.
- Compute log-likelihood for censored data.
Example 6
Summary: Calculates and generates new columns in a JMP data table, specifically 'time point', 'segments', and 'cycle', using formulas that increment values based on conditions.
Code:
//
New Column( "time point",
formula(
If( Row() == 1,
1,
If(
:power == 0 &
Lag( :time point, 1 ) <=
50,
Lag( :time point, 1 ) + 1,
If( :power == 0,
1,
Lag( :time point, 1 )
+ 1
)
)
)
)
);
New Column( "segments",
formula(
If(
Row() == 1, 0,
:time point == 1,
Lag( :segments, 1 ) + 1,
Lag( :segments, 1 )
)
)
);
New Column( "cycle",
formula(
If(
:time point > 70 | :segments
== 0,
.,
:segments
)
)
);
Code Explanation:
- Create new column "time point".
- Define formula for "time point".
- Check if row is 1.
- Set "time point" to 1.
- Check if power is 0 and lagged "time point" <= 50.
- Increment lagged "time point" by 1.
- Check if power is 0.
- Set "time point" to 1.
- Increment lagged "time point" by 1.
- Create new column "segments".
- Define formula for "segments".
- Check if row is 1.
- Set "segments" to 0.
- Check if "time point" equals 1.
- Increment lagged "segments" by 1.
- Set "segments" to lagged "segments".
- Create new column "cycle".
- Define formula for "cycle".
- Check if "time point" > 70 or "segments" equals 0.
- Set "cycle" to missing.
- Set "cycle" to "segments".
Example 7
Summary: Creates a new column in a JMP data table, populating the first three rows with country names from a predefined list and leaving remaining rows empty.
Code:
dt = Open("data_table.jmp");
dt << New Column( "nations", character );
myCountries = {"US", "China", "French"};
For( i = 1, i <= N Row( dt ), i++,
If( i <= 3,
:nations[i] = myCountries[i],
:nations[i] = ""
)
);
Code Explanation:
- Open data table;
- Add new column "nations".
- Define country list.
- Loop through rows.
- Assign first three countries.
- Leave remaining nations empty.
Example 8
Summary: Creates a new character column in a JMP data table by concatenating values from existing columns, including 'sex' and 'name'.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Special Name", char, formula( :sex || " \ " || :name ) );
Code Explanation:
- Open data table;
- Create new column named "Special Name".
- Set column data type to character.
- Define formula for new column.
- Concatenate "sex" and "name" columns.
- Insert space between concatenated values.
Example 9
Summary: Calculates and visualizes Body Mass Index (BMI) values from a data table, utilizing a formula-based column creation.
Code:
dt = Open("data_table.jmp");
dt << New Column( "BMI", Numeric, "Continuous", Format( "Best", 12 ), Formula( (:weight * 703) / :height ^ 2 ) );
my grid = [11 -5, 5 1, 11 -5, 5 1];
Code Explanation:
- Open data table.
- Create new column "BMI".
- Define BMI formula.
- Assign grid values.
Example 10
Summary: Creates a new column with random integer values, utilizing the Open and New Column functions in JMP Scripting Language.
Code:
dt = Open("data_table.jmp");
dt << New Column( "myFreq", formula( Random Integer( -6, 6 ) ) );
Code Explanation:
- Open data table;
- Create new column "myFreq".
- Assign random integers to "myFreq".
Example 11
Summary: Creates a new column 'ratio' by dividing height by weight in a data table, utilizing the Open and New Column functions.
Code:
dt = Open("data_table.jmp");
dt << New Column( "ratio", Formula( :height / :weight ) );
Code Explanation:
- Open data table;
- Create new column "ratio".
- Set formula for "ratio" column.
- Divide height by weight for each row.
Example 12
Summary: Creates a new column in a JMP data table, calculating the ratio of height to weight and formatting it as a percentage.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Ratio", numeric, continuous, Format( percent ), formula( :height / :weight ) );
Code Explanation:
- Open data table.
- Create new column named "Ratio".
- Set column type to numeric.
- Define column as continuous.
- Apply percent format to column.
- Assign formula for height divided by weight.
Example 13
Summary: Creates a new column '_bycol' with nominal values 'A' and 'B', repeated for all rows in the data table.
Code:
dt = Open("data_table.jmp");
dt << New Column( "_bycol", Character, Nominal, set values( Repeat( {"A", "B"}, N Rows( dt ) )[1 :: N Rows( dt )] ) );
Code Explanation:
- Open data table.
- Create new column "_bycol".
- Set column type to Character.
- Set column modeling type to Nominal.
- Generate values "A", "B".
- Repeat values for all rows.
- Assign generated values to "_bycol".
Example 14
Summary: Creates a new column in a JMP data table with a custom prediction formula based on height values.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Pred Formula",
formula(
If( Is Missing( :height ) | :height < 65,
If( Is Missing( :height ) | :height < 60,
79,
101.157894736842
),
123.214285714286
)
)
);
Code Explanation:
- Open data table.
- Create new column "Pred Formula".
- Define formula for prediction.
- Check if height is missing or less than 65.
- If true, check if height is missing or less than 60.
- If true, set prediction to 79.
- If false, set prediction to 101.157894736842.
- If false, set prediction to 123.214285714286.
Example 15
Summary: Creates a new column in a JMP data table, categorizing individuals based on their age (over 70 or not) and retrieving all column names.
Code:
dt under test = Open("data_table.jmp");
dt under test << New Column( "Over 70", numeric, nominal, values( (Column( "Age(years)" ) << get values) > 70 ) );
cols = dt under test << get column names();
Code Explanation:
- Open data table;
- Create "Over 70" column.
- Set "Over 70" as nominal.
- Assign age values > 70.
- Retrieve all column names.
Example 16
Summary: Creates a new column in a data table and populates it with specific values, also modifying existing columns.
Code:
dt = Open("data_table.jmp");
dt << New Column( "ec", "Expression" );
dt[1, "ec"] = {{"A"}};
dt[2, 6] = [4 5 3];
dt[3, 6 :: 6] = {[44 5 3]};
dt[4 :: 4, 6 :: 6] = {{[444 5 3]}};
var = List( 1, 2, 3 );
n = [1];
Code Explanation:
- Open data table;
- Add new column "ec".
- Set first row's "ec" to {"A"}.
- Set second row's sixth column to [4 5 3].
- Set third row's sixth column to {[44 5 3]}.
- Set fourth row's sixth column to {{[444 5 3]}}.
- Create list var with elements 1, 2, 3.
- Create array n with element 1.
Example 17
Summary: Creates a new column in a JMP data table, setting its formula to excluded.
Code:
Dt_lab = Open( "$SAMPLE_DATA\data_table.jmp", private );
Dt_lab << New Column( "rscol", Formula( Excluded() ) );
Code Explanation:
- Open table.
- Create new column.
- Set formula to excluded.
Example 18
Summary: Prepares data and initialization for further analysis by opening a data table, retrieving character column names, initializing empty lists and matrices, and creating a new numeric column.
Code:
dt = Open("data_table.jmp");
name list = dt << get column names( "character", "string" );
emptyList = {};
emptyMatrix = [];
dt2 = New Table( New Column( "col1", Numeric ) );
Code Explanation:
- Open data table.
- Retrieve character column names.
- Initialize empty list.
- Initialize empty matrix.
- Create new data table.
- Add numeric column "col1".
Example 19
Summary: Creates and calculates a new column 'ratio' in a data table, setting its formula to 5/11 and evaluating it.
Code:
dt = Open("data_table.jmp");
col = New Column( "ratio" );
col << Set Formula( 5 / 11 );
col << Eval Formula;
a = col << GetAsMatrix;
Code Explanation:
- Open data table;
- Create new column "ratio".
- Set column formula to 5/11.
- Evaluate column formula.
- Retrieve column values as matrix.
Example 20
Summary: Creates a new column 'Test' in a data table by adding the values of 'height' and 'weight', then selecting these columns for further analysis.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Test", numeric, continuous, formula( :height + weight ) );
dt << RunFormulas;
Column( "height" ) << set selected;
Column( "weight" ) << set selected;
Column( "Test" ) << set selected;
dt << delete columns();
Code Explanation:
- Open data table.
- Create new column "Test".
- Define formula for "Test".
- Run formulas on table.
- Select "height" column.
- Select "weight" column.
- Select "Test" column.
- Delete all columns from table.
Example 21
Summary: Creates two new numeric columns in a JMP data table, with formulas based on existing columns and custom formatting.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Label1A \!N Label2A \!N myValue ",
Numeric,
"Continuous",
Format( 20, 0 ),
Formula( :weight * 3 ),
Set Property( "Units", "someUnit" )
);
dt << New Column( "Label1B \!N Label2B \!N myValue ",
Numeric,
"Continuous",
Format( 20, 0 ),
Formula( :age * 3 ),
Set Property( "Units", "someUnit" )
);
dt << Set Header Height( 50 );
newvalue1 = Column( 6 )[1];
newvalue2 = Column( 7 )[40];
Code Explanation:
- Open data table;
- Add new column "Label1A !N Label2A !N myValue ".
- Set column as numeric and continuous.
- Format column width to 20.
- Define formula as weight * 3.
- Set units property to "someUnit".
- Add new column "Label1B !N Label2B !N myValue ".
- Set column as numeric and continuous.
- Format column width to 20.
- Define formula as age * 3.
- Set units property to "someUnit".
- Increase header height to 50.
- Assign first value of sixth column to newvalue1.
- Assign 40th value of seventh column to newvalue2.
Example 22
Summary: Creates a data table with additional columns for row state, photos, and fit line by age, utilizing JMP's New Column function.
Code:
dt1 = Open("data_table.jmp");
dt1 << New Column( "Rowstate Col", row state );
dt1 << New Column( "Photos", expression );
dt1 << New Column( "Fit Line By Age", expression );
Code Explanation:
- Open data table;
- Add "Rowstate Col" column.
- Add "Photos" column.
- Add "Fit Line By Age" column.
Example 23
Summary: Creates a new column 'X' in a data table, using the Munger function to extract specific values from another column.
Code:
dt = Open("data_table.jmp");
dt << New Column( "X", Formula( Munger( :name, 1, "M" ) ) );
Column( "X" ) << Eval Formula;
colVals = Column( dt, "x" ) << Get Values;
Code Explanation:
- Open data table.
- Create new column "X".
- Set formula for column "X".
- Evaluate formula for column "X".
- Retrieve values from column "X".
Example 24
Summary: Creates a new column in a JMP data table, setting its properties and filling it with a specified value.
Code:
dt = Open("data_table.jmp");
dt << New Column( "example", Numeric, Continuous, Width( 5 ), Format( ddMonyyyy h:m:s ), <<Set Each Value( 100 ) );
Code Explanation:
- Open data table.
- Add new column.
- Set column properties.
- Fill column with value.
Example 25
Summary: Creates a new column in a JMP data table to identify rows containing 'Cheese' using the Contains Item function.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Cheese", numeric, continuous, Formula( Contains Item( dt:Item Name, "Cheese", ", " ) ) );
Code Explanation:
- Open table.
- Create new column.
- Define column name.
- Set column type.
- Specify column properties.
- Apply formula to column.
- Use Contains Item function.
- Check for "Cheese".
- Use ", " as delimiter.
- Store result in column.
Example 26
Summary: Creates new columns in a JMP data table, including 'Soccer', 'Stomach', and 'Jetta' columns, using formulas that contain specific items or values.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Soccer", numeric, continuous, Formula( Contains Item( dt:sports, "Soccer", ", " ) ) );
dt << New Column( "Stomach", numeric, continuous, Formula( Contains Item( Lowercase( dt:reported illnesses ), "stomach", ", " ) ) );
cars = dt:family cars << get values;
dt << New Column( "Cars MR Prop", character, nominal, Set Property( "Multiple Response", {Separator( "," )} ), Set Values( cars ) );
dt << New Column( "Jetta", numeric, continuous, Formula( Contains Item( dt:Cars MR Prop, "Jetta", ", " ) ) );
Code Explanation:
- Open data table.
- Create "Soccer" column.
- Create "Stomach" column.
- Get family car values.
- Create "Cars MR Prop" column.
- Create "Jetta" column.
Example 27
Summary: Creates a new column in a data table by dividing age by weight and formatting it as a fixed decimal with 4 precision places.
Code:
dt = Open("data_table.jmp");
dt << New Column( "x", Formula( :age / :weight ), Format( "Fixed Dec", 10, 4 ) );
Code Explanation:
- Open data table;
- Create new column named "x".
- Set formula for column "x".
- Divide age by weight in formula.
- Format column "x" as fixed decimal.
- Set precision to 4 decimal places.
Example 28
Summary: Creates a new column in a JMP data table, calculating the square of the weight variable and capturing log output.
Code:
dt = Open("data_table.jmp");
dt << New Column( "expr", "Numeric", "Continuous", Formula( weight * weight ) );
log = Log Capture( dt:expr << Set Formula( {weight * weight} ) );
Code Explanation:
- Open data table;
- Create new column "expr".
- Set column type to numeric.
- Define column as continuous.
- Assign formula weight squared.
- Capture log output.
- Update formula for expr column.
Example 29
Summary: Creates a new column in a JMP data table, using a formula that applies the Lag function based on sex and name.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Lag Test", "Character", "Nominal", Formula( If( :sex == "M", Lag( :name ), Lag() ) ) );
Code Explanation:
- Open data table;
- Create new column "Lag Test".
- Set column data type to Character.
- Set modeling type to Nominal.
- Define column formula.
- Check if sex is Male.
- Apply Lag function to name if Male.
- Apply Lag function without arguments otherwise.
- End of script.
Example 30
Summary: Creates a new nominal column 'Validation 2' in a JMP data table, using a random category formula with specified probabilities.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Validation 2", nominal, formula( Random Category( 0.4, 0, 0.35, 1, 2 ) ) );
Code Explanation:
- Open data table;
- Add new column "Validation 2".
- Set column type to nominal.
- Apply random category formula.
- Assign probabilities for categories.
Example 31
Summary: Fits a standard least squares model with multiple effects and generates a profiler plot to analyze the relationship between 'Y' and 'Sodium mg' in the data table.
Code:
dt = Open("data_table.jmp");
New Column( "Y", Character, Nominal, Set Values( Repeat( {"F"}, 38 ) || Repeat( {"M"}, 37 ) ) );
bv = dt << Fit Y by X( Y( :Y ), X( :Sodium mg ), Weight( :"Oz/pkg" ) );
Code Explanation:
- Open data table;
- Create new column "Y".
- Set column type to Character.
- Set column modeling type to Nominal.
- Fill first 38 rows with "F".
- Fill next 37 rows with "M".
- Fit Y by X analysis.
- Set Y variable to "Y".
- Set X variable to "Sodium mg".
- Set weight to "Oz/pkg".
Example 32
Summary: Process of generating a password list by importing a remote word list, selecting short words, and creating a new table with a 'PW' column and a date formula.
Code:
Names Default To Here( 1 );
dtwords = Open(
"https://www.mit.edu/~ecprice/wordlist.10000",
columns( New Column( "a", Character, "Nominal" ) ),
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Tab, Comma, CSV( 1 ) ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Use Regional Settings( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 0 ),
Column Names Start( 1 ),
First Named Column( 1 ),
Data Starts( 1 ),
Lines To Read( "All" ),
Year Rule( "20xx" )
)
);
dtwords:a << Set Name( "Word_entry" );
dtwords << Select where( Length( :Word_entry ) < 8 );
dtwords << Delete rows();
pslist = {};
For Each( {i}, 1 :: 27,
r = Random Integer( 1, N Rows( dtwords ) );
Insert Into( pslist, :Word_entry[r] );
);
dtpwds = New Table( "PW List",
New Column( "PW", "Character", set values( pslist ) ),
New Column( "Date",
Format( "m/d/y" ),
set formula( Date Increment( Today(), "day", Row() ) )
)
);
Code Explanation:
- Open remote word list.
- Create new column "a".
- Set import settings.
- Import data into table.
- Rename column "a" to "Word_entry".
- Select short words.
- Delete selected rows.
- Initialize password list.
- Loop to select random words.
- Create new table "PW List".
- Add "PW" column.
- Add "Date" column.
- Set date formula.
- Open Google Sheets link.
Example 33
Summary: Retrieves and displays environment variable values in a JMP table, allowing for easy exploration and analysis.
Code:
Names Default To Here( 1 );
dt = New Table( "Environemnt Variables" );
dt << New Column( "Variable",
Character,
Set Values(
{"ALLUSERSPROFILE", "APPDATA", "CD", "CMDCMDLINE", "CMDEXTVERSION", "COMMONPROGRAMFILES", "COMMONPROGRAMFILES(x86)", "CommonProgramW6432",
"COMPUTERNAME", "COMSPEC", "DATE", "DriverData", "ERRORLEVEL", "HOMEDRIVE", "HOMEPATH", "LOCALAPPDATA", "LOGONSERVER", "NUMBER_OF_PROCESSORS",
"OneDrive", "OS", "PATH", "PathExt", "PROCESSOR_IDENTIFIER", "PROCESSOR_LEVEL", "PROCESSOR_REVISION", "PROGRAMDATA", "PROGRAMFILES",
"PROGRAMFILES(X86)", "ProgramW6432", "PROMPT", "PSModulePath", "PUBLIC", "RANDOM", "SystemDrive", "SystemRoot", "TEMP", "TIME", "TMP",
"USERDOMAIN", "USERDOMAIN_ROAMINGPROFILE", "USERNAME", "USERPROFILE", "WINDIR"}
)
);
dt << New Column( "Output", Character );
For Each Row( dt, :Output = Get Environment Variable( :Variable ) );
Code Explanation:
- Set default names scope.
- Create new table.
- Name table "Environemnt Variables".
- Add "Variable" column.
- Set column data type to character.
- Populate "Variable" column with environment variable names.
- Add "Output" column.
- Set column data type to character.
- Loop through each row.
- Get environment variable value for current row.
Column using N Row
Summary: This JSL script expands data by counts, creating a new table with start and end times repeated according to the count values.
Code:
// Expand Data by Counts
// Open data table
dt = Open("data_table.jmp");
// Expand Data by Counts
Names Default To Here( 1 );
start = :start time << GetAsMatrix;
end = :end time << GetAsMatrix;
c = :count << GetAsMatrix;
n = N Row();
nr = Sum( c );
start name = :start time << Get Name;
end name = :end time << Get Name;
dt =
New Table( "",
Add Rows( nr ),
New Column( start name, Numeric ),
New Column( end name, Numeric )
);
st = Column( dt, start name );
en = Column( dt, end name );
irow = 0;
For( i = 1, i <= n, i++,
For( j = 1, j <= c[i], j++,
irow++;
st[irow] = start[i];
en[irow] = end[i];
)
);
Names Default To Here( 0 );
Code Explanation:
- Open data table.
- Initialize variables.
- Extract start times.
- Extract end times.
- Extract counts.
- Calculate total rows.
- Store column names.
- Create new table.
- Add columns to table.
- Populate table with expanded data.
Column using Run Script
Example 1
Summary: Creates a ternary plot and modifies a value in column 'p1' within an open data table.
Code:
dt = Open("data_table.jmp");
tern = dt << Run Script( "Ternary Plot" );
Column( dt, "p1" )[6] = .8;
Code Explanation:
- Open data table;
- Assign dataset to variable
dt. - Run script for ternary plot.
- Assign ternary plot to variable
tern. - Modify value in column "p1".
Example 2
Summary: Fits a life table by X, adding a new column to the data table, capturing log information, deleting columns 1-6, setting time acceleration baseline, and closing the window.
Code:
dt = Open("data_table.jmp");
fl = dt << Run Script( "Fit Life by X" );
dt << New Column();
Log Capture( dt << Delete Columns( 1 :: 6 ) );
fl << Time Acceleration Baseline( 11 );
fl << close window;
Code Explanation:
- Open table.
- Run "Fit Life by X".
- Add new column.
- Capture log.
- Delete columns 1 to 6.
- Set time acceleration baseline.
- Close window.
Example 3
Summary: Runs the life distribution analysis and creates a new column in the data table, while capturing log output and deleting columns 1 through 5.
Code:
dt = Open("data_table.jmp");
ld = dt << Run Script( "Life Distribution - Exponential" );
dt << New Column();
Log Capture( dt << Delete Columns( 1 :: 5 ) );
Code Explanation:
- Open data table;
- Run life distribution script.
- Create new column.
- Capture log output.
- Delete columns 1 through 5.
Example 4
Summary: Process of running a destructive degradation fit, creating a new column, and deleting the first four columns in a data table.
Code:
dt = Open("data_table.jmp");
deg = dt << Run Script( "Destructive Degradation Fit" );
dt << New Column();
Log Capture( dt << Delete Columns( 1 :: 4 ) );
Code Explanation:
- Open data table.
- Run destructive degradation fit.
- Create new column.
- Delete first four columns.
- Capture log output.
Example 5
Summary: Fits a life table model, adding a new column to the data table, and deleting columns 1 through 6.
Code:
dt = Open("data_table.jmp");
fl = dt << Run Script( "Fit Life by X" );
dt << New Column();
Log Capture( dt << Delete Columns( 1 :: 6 ) );
Code Explanation:
- Open data table.
- Run "Fit Life by X" script.
- Add new column to table.
- Delete columns 1 through 6.
Example 6
Summary: Analyze and visualize a parametric survival model, including distribution plotting and column deletion.
Code:
dt = Open("data_table.jmp");
ps = dt << Run Script( "Fit Parametric Survival" );
dt << New Column();
Log Capture( dt << Delete Columns( 1 :: 3 ) );
ps << Distribution Plot by Level Combinations;
ps << close window;
Code Explanation:
- Open data table.
- Run parametric survival script.
- Add new column.
- Log capture delete columns.
- Create distribution plot.
- Close window.
Example 7
Summary: Fits a lognormal distribution to data and deleting columns 1-6, while capturing log output.
Code:
dt = Open("data_table.jmp");
fl = dt << Run Script( "Fit Life by X" );
dt << New Column();
Log Capture( dt << Delete Columns( 1 :: 6 ) );
fl << Fit Lognormal;
fl << close window;
Code Explanation:
- Open data table.
- Run "Fit Life by X" script.
- Add new column to table.
- Capture log output.
- Delete columns 1 to 6.
- Fit lognormal distribution.
- Close fit life window.
Column using For
Example 1
Summary: Modifies height values by multiplying them by -1 for rows where age is 12 in a specified data table.
Code:
dt = Open("data_table.jmp");
rs = dt << get rows where( :age == 12 );
For( i = 1, i <= N Items( rs ), i++,
Column( "height" )[i] = (-1) * Column( "height" )[i]
);
Code Explanation:
- Open data table.
- Retrieve rows where age is 12.
- Loop through selected rows.
- Multiply height values by -1.
Example 2
Summary: Generates a distribution analysis for continuous variables in a specified data table, utilizing the Distribution platform to create a Resample Freq column and populate testVar with relevant values.
Code:
dt = Open("data_table.jmp");
xlist = {"1", "2", "3", "4"};
testVar = {};
For( i = 1, i <= N Items( xlist ), i++,
y = "sex";
If( i == 3, y = "height" );
Match( xlist[i],
xlist[1], Insert Into( testVar, Eval List( {i, y} ) ),
xlist[2], Insert Into( testVar, Eval List( {i, y} ) ),
xlist[3],
New Column( "Resample Freq", numeric, Formula( Resample Freq( 5, Column( dt, y ) ) ) );
Insert Into( testVar, Eval List( {i, y} ) );
testVar2 = :Resample Freq << Get Values;,
xlist[4], Insert Into( testVar, Eval List( {i, y} ) ),
Insert Into( testVar, Eval List( {i, y, "error"} ) )
);
);
Code Explanation:
- Open data table.
- Define xlist with four items.
- Initialize empty list testVar.
- Loop through each item in xlist.
- Set y to "sex".
- Change y to "height" if i equals 3.
- Match current xlist item.
- Insert i and y into testVar for first two items.
- Create "Resample Freq" column for third item.
- Insert i, y, and values from "Resample Freq" into testVar.
Example 3
Summary: Generates a distribution analysis for continuous variables in a specified data table, utilizing the MatchMZ function to create a new column and populate a test variable.
Code:
dt = Open("data_table.jmp");
xlist = {"1", "2", "3", "4"};
testVar = {};
For( i = 1, i <= N Items( xlist ), i++,
y = "sex";
If( i == 3, y = "height" );
MatchMZ( xlist[i],
xlist[1], Insert Into( testVar, Eval List( {i, y} ) ),
xlist[2], Insert Into( testVar, Eval List( {i, y} ) ),
xlist[3],
New Column( "Resample Freq", numeric, Formula( Resample Freq( 5, Column( dt, y ) ) ) );
Insert Into( testVar, Eval List( {i, y} ) );
testVar2 = :Resample Freq << Get Values;,
xlist[4], Insert Into( testVar, Eval List( {i, y} ) ),
Insert Into( testVar, Eval List( {i, y, "error"} ) )
);
);
Code Explanation:
- Open data table;
- Define xlist with 4 elements.
- Initialize empty list testVar.
- Loop through each item in xlist.
- Set y to "sex".
- Change y to "height" if i equals 3.
- Match xlist[i] with cases.
- For xlist[1] and [2], insert {i, y} into testVar.
- For xlist[3], create "Resample Freq" column.
- Insert {i, y} into testVar and get values.
Example 4
Summary: Generates distribution analysis for continuous variables in a specified data table using the Distribution platform, with interactive features and conditional logic.
Code:
dt = Open("data_table.jmp");
xlist = {"1", "2", "3", "4"};
testVar = {};
For( i = 1, i <= N Items( xlist ), i++,
y = "sex";
If( i == 3, y = "height" );
MatchV3( xlist[i],
xlist[1], Insert Into( testVar, Eval List( {i, y} ) ),
xlist[2], Insert Into( testVar, Eval List( {i, y} ) ),
xlist[3],
New Column( "Resample Freq", numeric, Formula( Resample Freq( 5, Column( dt, y ) ) ) );
Insert Into( testVar, Eval List( {i, y} ) );
testVar2 = :Resample Freq << Get Values;,
xlist[4], Insert Into( testVar, Eval List( {i, y} ) ),
Insert Into( testVar, Eval List( {i, y, "error"} ) )
);
);
Code Explanation:
- Open data table.
- Define variable list.
- Initialize empty testVar.
- Start loop through xlist.
- Set y to "sex".
- Change y to "height" for third iteration.
- Match xlist item.
- Insert i and y into testVar.
- Create "Resample Freq" column for third match.
- Insert i, y, and values into testVar.
Column using Auto Clear
Summary: Data filtering and row retrieval by opening a data table, adding filters for age and sex, and retrieving the filtered rows.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter;
df << Auto Clear( 0 );
df << Add Filter( columns( :age, :sex ), Where( :age == {13, 14} ) );
df << (filter column( :sex ) << Where( :sex == "M" ));
fr = df << Get Filtered Rows( 1 );
Code Explanation:
- Open data table;
- Access Data Filter.
- Disable auto-clear filter.
- Add age filter for 13 and 14.
- Add sex filter for males.
- Retrieve filtered rows.
New Column by Text Matching
Example 1
Summary: Creates a new column in a data table by matching text using regular expressions from the 'Words' library, with the matched values stored in an output column named 'Regex: WordsⒷ斯冰川*()'.
Code:
dt = Open("data_table.jmp");
dt << New Column by Text Matching(
Column( Name( "Reasons Not to Floss" ) ),
Set Regex( Library( "Words" ) ),
output column name( "Regex: WordsⒷ斯冰川*()" )
);
Code Explanation:
- Open data table.
- Create new column.
- Match text using regex.
- Specify column for matching.
- Use regex library "Words".
- Name output column.
- Regex pattern "WordsⒷ斯冰川*()".
Example 2
Summary: Extracts specific text patterns from a column in a JMP data table, utilizing regular expressions and text matching.
Code:
Open("data_table.jmp");
New Column by Text Matching(
Column( :Reasons Not to Floss ),
Set Regex( Separators( Characters( "e" ), Result( "\[\1]\" ) ) ),
Use Result( 1 )
);
Code Explanation:
- Open data table;
- Create new column.
- Specify matching column.
- Set regex separators.
- Define result format.
- Apply regex matching.
- Extract first match.
Example 3
Summary: Creates a new column in a data table by text matching, using regular expressions to extract specific patterns.
Code:
dt = Open("data_table.jmp");
New Column by Text Matching(
Column( :Reasons Not to Floss ),
Set Regex( Separators( Characters( "e" ), Result( "\[\1]\" ) ) ),
Use Result( 0 )
);
Code Explanation:
- Open data table.
- Create new column.
- Define text matching.
- Set regex separators.
- Specify result format.
- Use regex result.
Example 4
Summary: Creates a new column in a data table by text matching using regular expressions from the 'Words' library, with the matched output column named 'Regex: WordsⒷ斯冰川*()'.
Code:
dt = Open("data_table.jmp");
dt << New Column by Text Matching(
Column( Name( "Reasons Not to Floss" ) ),
Set Regex( Library( "Words" ) ),
output column name( "Regex: WordsⒷ斯冰川*()" ),
Use Result( {} )
);
Code Explanation:
- Open data table;
- Create new column by text matching.
- Match text in "Reasons Not to Floss".
- Use regex library "Words".
- Name output column "Regex: WordsⒷ斯冰川*()".
- Use result for further processing.
Example 5
Summary: Creates a new column in a data table by text matching using the 'New Column by Text Matching' function, with regex patterns from the 'Words' library.
Code:
dt = Open("data_table.jmp");
dt << New Column by Text Matching(
Column( Name( "Reasons Not to Floss" ) ),
Set Regex( Library( "Words" ) ),
output column name( "Regex: WordsⒷ斯冰川*()" ),
Use Result
);
Code Explanation:
- Open data table;
- Create new column by text matching.
- Match Reasons Not to Floss.
- Set regex from Words library.
- Output column named "Regex: WordsⒷ斯冰川*()".
- Use regex match result.
Example 6
Summary: Creates a new column by matching text using regular expressions from the 'Words' library, and sets the output column name.
Code:
dt = Open("data_table.jmp");
dt << New Column by Text Matching(
Column( Name( "Reasons Not to Floss" ) ),
Set Regex( Library( "Words" ) ),
output column name( "Regex: WordsⒷ斯冰川*()" ),
Use Result()
);
Code Explanation:
- Open data table.
- Create new column.
- Match text using regex.
- Use regex library "Words".
- Set output column name.
- Apply regex matching.
Example 7
Summary: Creates a new column in a data table by text matching using the New Column by Text Matching platform, with regex from the Words library and outputting to a specified column name.
Code:
dt = Open("data_table.jmp");
dt << New Column by Text Matching(
Column( Name( "Reasons Not to Floss" ) ),
Set Regex( Library( "Words" ) ),
output column name( "Regex: WordsⒷ斯冰川*()" ),
Use Result( "abcde" )
);
Code Explanation:
- Open data table;
- Create new column by text matching.
- Specify Reasons Not to Floss column.
- Set regex from Words library.
- Name output column Regex: Words.
- Use result abcde.
Example 8
Summary: Creates a new column by matching text in a data table, utilizing regex from a library and specifying an output column name.
Code:
dt = Open("data_table.jmp");
dt << New Column by Text Matching(
Column( Name( "Reasons Not to Floss" ) ),
Set Regex( Library( "Words" ) ),
output column name( "Regex: WordsⒷ斯冰川*()" ),
Use Result( . )
);
Code Explanation:
- Open data table.
- Create new column by matching text.
- Specify column for matching.
- Set regex from library.
- Define output column name.
- Use result for matching.
Example 9
Summary: Creates a new column in a data table by text matching using regular expressions from the 'Words' library, with the result value set to -111.11.
Code:
dt = Open("data_table.jmp");
dt << New Column by Text Matching(
Column( Name( "Reasons Not to Floss" ) ),
Set Regex( Library( "Words" ) ),
output column name( "Regex: WordsⒷ斯冰川*()" ),
Use Result( -111.11 )
);
Code Explanation:
- Open data table.
- Create new column.
- Use text matching.
- Specify column for matching.
- Set regex library.
- Define output column name.
- Use result value.
Column using Delete Rows
Summary: Data filtering and selection by opening a JMP data table, deleting rows, selecting rows based on age, creating a column selection, and retrieving the selected matrix.
Code:
dt = Open("data_table.jmp");
dt << Delete Rows( 21 :: 40 );
dt << Select Where( :age < 14 );
dt << Name Selection in Column( Column Name( "Younger" ), Selected( 1 ), unselected( 0 ) );
m = dt:Younger << Get As Matrix();
Code Explanation:
- Open data_table data
- Delete rows 21 to 40.
- Select rows where age < 14.
- Create "Younger" column selection.
- Retrieve "Younger" column matrix.
Column using Function
Example 1
Summary: Runs the renaming of a column in a JMP data table, utilizing a custom function to notify on rename events.
Code:
dt = Open("data_table.jmp");
renameNotify = Function( {dtab, newname, oldname},
dtname = Word( 1, dtab << getname(), "." );
Write( "dtname=", dtname );
Write( "\!Noldname=", oldname );
Write( "\!Nnewname=", newname );
);
dt << Subscribe( "rename", On rename column( renameNotify ) );
dt:sex << Set Name( "Gender" );
Code Explanation:
- Open data table.
- Define renameNotify function.
- Subscribe to rename event.
- Rename 'sex' column to 'Gender'.
Example 2
Summary: Process of updating a data table's name column value and subscribing to save events, utilizing JMP scripting language.
Code:
dtb = Open("data_table.jmp");
fsave = Function( {dtab, newpathname},
Insert Into( changeList, Word( 1, dtab << get name, "." ) )
);
dtb << Subscribe( "name15b"("client"), On Save( fsave ) );
Column( dtb, "name" )[1] = "PENELOPE";
Code Explanation:
- Open data table.
- Define function
fsave. - Subscribe to save event.
- Change first row's name column value.
Column using Save
Example 1
Summary: Opens and saves a data table, renaming a column to 'Gender'.
Code:
dt = Open("data_table.jmp");
dt << Save( "$TEMP\testit.jmp" );
Column( dt, "sex" ) << set name( "Gender" );
Code Explanation:
- Open data table.
- Save table to temp location.
- Rename "sex" column to "Gender".
Example 2
Summary: Runs data processing by opening a data table, renaming a column, and retrieving column names.
Code:
dt = Open("data_table.jmp");
dt << Save( "$TEMP\testit.jmp" );
Column( dt, "sex" ) << set name( "Gender" );
dt2 = Open("data_table.jmp");
colnames = dt2 << get column names();
Code Explanation:
- Open data_table data
- Save data to testit.jmp.
- Rename "sex" column to "Gender".
- Open data_table data
- Retrieve column names.
Column using Select Where
Example 1
Summary: Data filtering and coloring in JMP to select rows where age is 12 and color selected cells light yellow, while also coloring all cells light green.
Code:
dt = Open("data_table.jmp");
r = dt << Select Where( :age == 12 );
Column( dt, 1 ) << Color Cells( "Light Yellow", r );
Column( dt, 1 ) << Color Cells( "light green" );
Code Explanation:
- Open data table.
- Select rows where age is 12.
- Color selected cells light yellow.
- Color all cells light green.
Example 2
Summary: Explores data and visualization by selecting specific rows, coloring cells, running a Bivariate script, and setting row states.
Code:
dt = Open("data_table.jmp");
r = dt << Select Where( :age == 12 );
Column( dt, 1 ) << Color Cells( "Light Yellow", r );
Column( dt, 1 ) << Color Cells( "light green" );
dt = Open("data_table.jmp");
obj = dt << Run Script( "Bivariate" );
dt << Select Where( :sex == "F" );
dt << Colors( "Red" );
rs = dt << Get row states;
Code Explanation:
- Open data table.
- Select rows where age is 12.
- Color selected cells light yellow.
- Color all cells light green.
- Reopen data table.
- Run Bivariate script.
- Select rows where sex is female.
- Set colors to red.
- Get row states.
Example 3
Summary: Data filtering and row state management by selecting specific rows, hiding and excluding others, and labeling and coloring the remaining rows.
Code:
dt = Open("data_table.jmp");
dt << Select Where( :age == 14 );
dt << Exclude;
dt << Select Where( :sex == "F" );
dt << Hide;
dt << Select Where( :sex == "M" );
dt << Label;
dt << Color Or Mark By Column( :age );
rs = dt << Get Row States;
dt << Select Where( :height > 60 );
dt << Hide and Exclude;
rs2 = dt << Get Row states;
dt << Hide and Exclude( 0 );
rs3 = dt << Get Row states;
Code Explanation:
- Open data table.
- Select age 14 rows.
- Exclude selected rows.
- Select female rows.
- Hide selected rows.
- Select male rows.
- Label selected rows.
- Color by age column.
- Get row states.
- Select height > 60 rows.
- Hide and exclude selected rows.
- Get new row states.
- Restore all rows visibility and exclusion.
Column using Row Selection
Summary: Selects and edits rows in a data table based on age, while keeping the dialog open and creating a window titled 'Select Rows'.
Code:
dt2 = Open("data_table.jmp");
dt2 << Row Selection( Select where( :age == 12 ), Dialog( Edit( Source Column( :age ) == "12" ), Keep dialog open ) );
win = Window( "Select Rows" );
Code Explanation:
- Open data table.
- Select rows where age is 12.
- Edit source column for age.
- Keep dialog open.
- Create window titled "Select Rows".
Add Multiple Columns
Summary: Process of adding multiple columns to a JMP table and retrieving data types, providing an efficient way to analyze and manipulate data.
Code:
dt = Open("data_table.jmp");
dt << Add Multiple Columns( "Express", 5, Expression );
typeList = {};
For( i = 1, i <= N Col( dt ), i++,
Insert Into( typeList, Column( i ) << Get Data Type )
);
Code Explanation:
- Open table.
- Add multiple columns.
- Initialize empty list.
- Loop through columns.
- Insert data types.
Delete Columns
Summary: Runs data cleaning and configuration tasks by opening a JMP data table, deleting columns, selecting rows, creating a new data box, and enabling/disabling value labels for the color column.
Code:
dt = Open("data_table.jmp");
dt << Delete Columns( {:satell, :width, :weight, :weightstd} );
dt << Select where( Row() > 5 );
dt << Delete Rows;
ndb = dt << new data box();
Column( "color" ) << Use Value Labels( 0 );
Column( "color" ) << Use Value Labels( 1 );
Column( "color" ) << Use Value Labels( 0 );
Column( "color" ) << Use Value Labels;
Column( "color" ) << Use Value Labels;
Code Explanation:
- Open data table;
- Delete columns: satell, width, weight, weightstd.
- Select rows greater than 5.
- Delete selected rows.
- Create new data box.
- Enable value labels for color column.
- Disable value labels for color column.
- Enable value labels for color column.
- Disable value labels for color column.
- Toggle value labels for color column.
Color or Mark by Column
Example 1
Summary: Vizualizes a data table by coloring and marking rows based on age, selecting female records, and creating a new window with a graph box.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", invisible );
dt << Color or Mark by Column( :Age, Color theme( "pastel" ), Marker theme( "alphanumeric" ) );
dt << Select Where( :sex == "F" );
dt << Hide;
dt << Clear Select;
sz = [11, 12, 13, 14];
nw15 = New Window( "Test", g15 = Graph Box( Lines Seg( [10 10 90 90, 10 90 90 10], Row states( dt, [5 11 21 30] ), Sizes( sz ) ) ) );
frame = g15[FrameBox( 1 )];
nw15 << Close Window;
Code Explanation:
- Open data table.
- Color rows by age.
- Mark rows by age.
- Select female rows.
- Hide selected rows.
- Clear selection.
- Define sizes array.
- Create new window.
- Add graph box.
- Close window.
Example 2
Summary: Vizualizes a data table by coloring and marking rows based on age, selecting female records, and creating a graph with marker segments.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", invisible );
dt << Color or Mark by Column( :Age, Color theme( "pastel" ), Marker theme( "alphanumeric" ) );
dt << Select Where( :sex == "F" );
dt << Hide;
dt << Clear Select;
sz = [11, 12, 13, 14];
nw15 = New Window( "Test", g15 = Graph Box( Marker Seg( [10 20 30 40], [40 30 20 10], Row states( dt, [5 11 20 29] ), Sizes( sz ) ) ) );
frame = g15[FrameBox( 1 )];
nw15 << Close Window;
Code Explanation:
- Open data table;
- Color by Age, mark by alphanumeric.
- Select female rows.
- Hide selected rows.
- Clear row selection.
- Define sizes array.
- Create new window with graph.
- Create marker segment graph.
- Access frame box.
- Close window.
Example 3
Summary: Visualizes and filters a data table, coloring or marking by age, selecting female rows, excluding selected rows, and creating a new window with a graph.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", invisible );
dt << Color or Mark by Column( :Age, Color theme( "pastel" ), Marker theme( "alphanumeric" ) );
dt << Select Where( :sex == "F" );
dt << Exclude;
dt << Clear Select;
sz = [11, 12, 13, 14];
nw29 = New Window( "Test", g29 = Graph Box( Marker Seg( [10 20 30 40], [40 30 20 10], Row states( dt, [5 11 20 29] ), Sizes( sz ) ) ) );
frame = g29[FrameBox( 1 )];
nw29 << Close Window;
Code Explanation:
- Open data table.
- Color and mark by age.
- Select female rows.
- Exclude selected rows.
- Clear row selection.
- Define sizes array.
- Create new window with graph.
- Access graph frame.
- Close created window.
Example 4
Summary: Vizualizes a data table by coloring and marking rows based on the Age column, selecting female records, and creating a new window with a graph box containing marker segments.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", invisible );
dt << Color or Mark by Column( :Age, Color theme( "pastel" ), Marker theme( "alphanumeric" ) );
dt << Select Where( :sex == "F" );
sz = [11, 12, 13, 14];
nw30b = New Window( "Test", g30b = Graph Box( Marker Seg( [10 20 30 40], [40 30 20 10], Row states( dt, [5 11 20 29] ), Sizes( sz ) ) ) );
frame = g30b[FrameBox( 1 )];
nw30b << Close Window;
Code Explanation:
- Open data table.
- Color/mark by age column.
- Select female rows.
- Define size array.
- Create new window.
- Add graph box with marker segments.
- Get frame box.
- Close window.
Column using Round
Summary: Executes various regression scripts on a data table, generating predicted values and standard errors for each model type.
Code:
dt = Open("data_table.jmp");
script list = {"Lasso", "Elastic Net", "Ridge Regression", "Maximum Likelihood", "Lasso Full Factorial", "Elastic Net Full Factorial",
"Ridge Regression Full Factorial"};
tmp = dt:TCH << get values;
dt:TCH << set values( Round( tmp ) );
dt:TCH << Modeling Type( "Ordinal" );
For( i = 1, i <= N Items( script list ), i++,
obj = dt << Run Script( script list[i] );
obj << (Fit[1] << Std Error of Predicted);
obj << (Fit[1] << Std Error of Predicted Formula);
saved pred1 = Column( dt, 15 ) << get values;
saved pred2 = Column( dt, 16 ) << get values;
obj << close window;
dt << Clear Column Selection;
Column( dt, 16 ) << set selected;
dt << Delete Columns;
Column( dt, 15 ) << set selected;
dt << Delete Columns;
);
Code Explanation:
- Open data table;
- Define script list.
- Get TCH values.
- Round TCH values.
- Set TCH modeling type to Ordinal.
- Loop through script list.
- Run current script.
- Add Std Error of Predicted.
- Add Std Error of Predicted Formula.
- Save predicted values.
Column using Clear Row States
Summary: Process of opening a data table, clearing row states, and adding a new column with frequency values based on a formula.
Code:
dt1 = Open("data_table.jmp");
dt1 << Clear Row States( 1 );
dt1 << New Column( "Freq", values( [2, 3] |/ J( N Rows( dt1 ) - 2, 1, 1 ) ) );
Code Explanation:
- Open data table.
- Clear row states.
- Add new column "Freq".
- Set column values using formula.
Column using Random Reset
Summary: Creates a new column in a data table using Make KFold Formula, stratified by height and grouped by age and sex.
Code:
dt = Open("data_table.jmp");
Random Reset( 123 );
dt << New Column( "5 Fold Column",
Numeric,
"Nominal",
Formula( Make KFold Formula( 5, <<Y Columns( :weight ), <<Stratification Columns( :height ), <<Grouping Columns( :age, :sex ) ) )
);
Code Explanation:
- Open data table.
- Set random seed.
- Create new column.
- Define column as numeric.
- Set column type to nominal.
- Apply formula to column.
- Use Make KFold Formula.
- Specify 5 folds.
- Include weight as Y column.
- Stratify by height.
- Group by age and sex.
Get Column Names
Summary: Runs data table operations by opening a file, retrieving column names, accessing the second column, and modifying the first row value.
Code:
dt = Open("data_table.jmp");
colNames = dt << Get Column Names( String );
Column( dt, colNames[2] )[1] = 1;
Code Explanation:
- Open data table.
- Retrieve column names.
- Access second column.
- Modify first row value.
Column using Log Capture
Summary: Executes a 'Degradation' script and subsequent data table operations, including adding a new column and deleting columns 1 to 4.
Code:
dt = Open("data_table.jmp");
Log Capture( deg = dt << Run Script( "Degradation" ) );
dt << New Column();
Log Capture( dt << Delete Columns( 1 :: 4 ) );
deg << Location Parameter Path( 1 );
deg << close window;
Code Explanation:
- Open data table.
- Run "Degradation" script.
- Log capture results.
- Add new column.
- Delete columns 1 to 4.
- Log capture deletion.
- Set location parameter path.
- Close window.
Column using For Each
Summary: Sorts individual columns in a data table without considering other columns, setting the sorted values back to each column.
Code:
//sort individual columns w/o respect to other columns, in situ
Names Default To Here( 1 );
dt = Open("data_table.jmp");
//lstcols = dt << Get Column Names;
For Each( {i}, 1::n cols (dt),
m1 = Column(i) << Get Values;
m2 = Sort Ascending( m1 );
column(i) << Set Values( m2 );
);
Code Explanation:
- Set default names.
- Open data table;
- Loop through each column.
- Get values of current column.
- Sort values in ascending order.
- Set sorted values back to column.
- Repeat for all columns.