Data Filter
Example 1
Summary: Filters data in the 'data_table.jmp' file to display only exterior office spaces, utilizing a Data Filter with a specific location and condition.
Code:
// Data Filter - Exterior Offices
// Open data table
dt = Open("data_table.jmp");
// Data Filter - Exterior Offices
Current Data Table() <<
Data Filter(
Location( {376, 286} ),
Add Filter(
columns( :type of space ),
Where(
:type of space == "exterior"
),
Display(
:type of space,
Size( 204, 123 ),
List Display
)
),
Mode( Select( 0 ), Include( 1 ) )
);
Code Explanation:
- Open data table.
- Set current data table.
- Add data filter.
- Set filter location.
- Add filter condition.
- Specify filter column.
- Define filter criteria.
- Display filtered column.
- Set display size.
- Use list display mode.
Example 2
Summary: Opens a data table, filters female records, selects and colors them red, re-selects the filtered rows, colors marital status cells, clears row states, and clears row selection.
Code:
Open("data_table.jmp");
Current Data Table() << Data Filter( Location( {1705, 73} ), Add Filter( columns( :sex ), Where( :sex == "Female" ) ) );
Data Table("data_table") << Select Where( :sex == "Female" ) << Colors( "Red" );
Data Table("data_table") << Select Where( :sex == "Female" );
:marital status << Color Cells( 6 );
Data Table("data_table") << Clear Row States;
Data Table("data_table") << Clear Select;
Code Explanation:
- Open data table;
- Apply data filter for females.
- Select all female rows.
- Color selected rows red.
- Re-select all female rows.
- Color marital status cells.
- Clear row states.
- Clear row selection.
Example 3
Summary: Opens a data table, filters female rows, highlights them in red, selects the filtered rows again, colors marital status cells, clears row states and selection, and resets cell colors.
Code:
Open("data_table.jmp");
Current Data Table() << Data Filter( Location( {1705, 73} ), Add Filter( columns( :sex ), Where( :sex == "Female" ) ) );
Data Table("data_table") << Select Where( :sex == "Female" ) << Colors( "Red" );
Data Table("data_table") << Select Where( :sex == "Female" );
:marital status << Color Cells( 6 );
Data Table("data_table") << Clear Row States;
Data Table("data_table") << Clear Select;
:marital status << Color Cells( "" );
Code Explanation:
- Open data table.
- Apply data filter.
- Highlight female rows red.
- Select female rows again.
- Color marital status cells.
- Clear row states.
- Clear selection.
- Reset marital status cell colors.
Example 4
Summary: Creates a filtered data table based on age, sex, and height conditions, with interactive filtering capabilities.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", private );
DFFav = dt << Data Filter(
Conditional,
Mode( Select( 0 ), Show( 1 ), Include( 1 ) ),
Add Filter( columns( :age, :sex, :height ), Order By Count( :age ) ),
Favorites( "height >= 60 & height <= 65"(Match( columns( :age, :sex, :height ), Where( :height >= 60 & :height <= 65 ) )) )
);
Code Explanation:
- Open data table.
- Create Data Filter object.
- Set filter mode to select.
- Display selected rows.
- Include selected rows in analysis.
- Add filter for age, sex, height.
- Order filter by count of age.
- Define favorite filter.
- Match rows where height is between 60 and 65.
Example 5
Summary: Creates a filtered data table based on age, sex, and height criteria, utilizing Data Filter to order by count and apply favorite filters.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", private );
DFFav = dt << Data Filter(
Conditional,
Mode( Select( 0 ), Show( 1 ), Include( 1 ) ),
Add Filter( columns( :age, :sex, :height ), Order By Count( :age ) ),
Favorites( "height >= 60 & height <= 65"(Match( columns( :age, :sex, :height ), Where( :height >= 60 & :height <= 65 ) )) )
);
DFFav << Apply Favorites( "height >= 60 & height <= 65" );
Code Explanation:
- Open data table.
- Create data filter object.
- Set filter mode to select.
- Show and include filter options.
- Add filter for age, sex, height.
- Order by count of age.
- Define favorite filter for height.
- Apply favorite filter for height range.
Example 6
Summary: Data filtering and row state management for a JMP data table, utilizing the Data Filter function to select specific regions and include/exclude rows based on conditions.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
obj = dt << Data Filter(
invisible,
Add Filter( columns( :Region, :POP ), Where( :Region == {"C", "N"} ) ),
Mode( Select( 0 ), Show( 0 ), Include( 1 ) )
);
If( Host is( Windows ),
ws = Window( "Data Filter for data_table" ) << get window size()
);
rs = dt << get row states;
Code Explanation:
- Open data table;
- Create data filter object.
- Set filter to invisible.
- Add filter for Region and POP columns.
- Filter where Region is "C" or "N".
- Set filter mode to select, show, include.
- Check if host is Windows.
- Get window size of "Data Filter for Cities".
- Get row states of the table.
- Store results in variables.
Example 7
Summary: Selects and displays specific data rows in a JMP data table, utilizing the Data Filter function to filter out unwanted records.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
obj = dt << Data Filter( Add Filter(), Mode( Select( 0 ), Show( 0 ), Include( 1 ) ) );
Code Explanation:
- Open data table.
- Create data filter object.
- Add filter to data table.
- Set filter mode to select.
- Hide filter interface.
- Include selected rows.
Example 8
Summary: Filters a data table to focus on specific regions and states, utilizing Data Filter objects to add filters based on population and geographic criteria.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
obj = dt << Data Filter();
obj << Add Filter( columns( :POP ), Where( :POP > 1000 ) );
obj << Add Filter( columns( :Region, :State, :City ), Where( :Region == "S" ), Where( :State == {"SC", "NC"} ) );
Code Explanation:
- Open data table.
- Create Data Filter object.
- Add filter for POP > 1000.
- Add filter for Region == "S".
- Add filter for State == "SC" or "NC".
Example 9
Summary: Data filtering and row state management for a specific age range in a JMP data table, utilizing the Data Filter function.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
df = dt << Data Filter( Add Filter( columns( :age ), Where( :age >= 31.86 & :age <= 60 ) ), Mode( Select( 0 ), Show( 0 ), Include( 1 ) ) );
rs = dt << get row states;
df << Mode( Select( 1 ), Show( 1 ), Include( 1 ) );
rs = dt << get row states;
df << Mode( Select( 0 ), Show( 0 ), Include( 0 ) );
rs = dt << get row states;
df << Mode( Select( 0 ), Show( 1 ), Include( 0 ) );
rs = dt << get row states;
df << Mode( Select( 1 ), Show( 0 ), Include( 0 ) );
rs = dt << get row states;
df << Mode( Select( 1 ), Show( 1 ), Include( 0 ) );
rs = dt << get row states;
df << Mode( Select( 0 ), Show( 1 ), Include( 1 ) );
rs = dt << get row states;
Code Explanation:
- Open data table;
- Create data filter for age.
- Set filter mode to select off.
- Get initial row states.
- Set filter mode to select on.
- Get row states after selection.
- Set filter mode to include off.
- Get row states after inclusion off.
- Set filter mode to show on.
- Get row states after showing.
Example 10
Summary: Filters and displays data based on specific state and region conditions, utilizing the Data Filter function in JMP.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
df = dt << Data Filter(
Location( {673, 234} ),
Add Filter(
columns( :State, :Region ),
Where( :State == {"AL", "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA"} ),
Where( :Region == {"MW", "N", "S"} ),
Display( :State, Size( 204, 174 ), List Display )
)
);
fr = df << Get Filtered Rows( 1 );
Code Explanation:
- Open data table.
- Create data filter.
- Set filter location.
- Add filter criteria.
- Specify filter columns.
- Define state filter conditions.
- Define region filter conditions.
- Set display options for state.
- Retrieve filtered rows.
- Assign filtered rows to variable.
Example 11
Summary: Data filtering and reporting for a specific geographic region, state, city, and lead range using the Data Filter function in JMP.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
df = dt << Data Filter(
Location( {730, 327} ),
Conditional,
Add Filter(
columns( :city, :State, :Region, :Lead ),
Where( :Region == "MW" ),
Where( :State == {"KS", "MI", "MN"} ),
Where( :city == {"DETROIT", "MINNEAPOLIS", "WICHITA"} ),
Where( :Lead >= 0.0606 & :Lead <= 0.24 ),
Display( :city, Size( 204, 174 ), List Display ),
Display( :State, Size( 204, 174 ), List Display ),
Display( :Lead )
)
);
If( Host is( windows ) & Is Empty( This Project() ),
,
dfrep = df << report
);
Code Explanation:
- Open table.
- Create data filter.
- Set filter location.
- Add conditional filter.
- Select columns for filtering.
- Filter by region.
- Filter by state.
- Filter by city.
- Filter by lead range.
- Display filtered data.
Example 12
Summary: Data filtering for specific regions and population values, enabling interactive selection and inclusion of filtered results.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
df = dt << Data Filter(
Add Filter( columns( :Region, :POP ), Where( :Region == {"C", "N"} ) ),
Mode( Select( 0 ), Show( 0 ), Include( 1 ) )
);
Code Explanation:
- Open data table.
- Create data filter object.
- Add filter for Region and POP columns.
- Set filter condition for Region.
- Configure filter mode to select.
- Hide filter controls initially.
- Enable filter inclusion.
Example 13
Summary: Data filtering and column selection to analyze specific regions, utilizing the Data Filter function in JMP.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
df = dt << Data Filter(
Add Filter( columns( :Region, :POP ), Where( :Region == {"C", "N"} ) ),
Mode( Select( 1 ), Show( 0 ), Include( 0 ) )
);
df << Columns( :SO2, :CO, :State );
df << Match( Filter Columns( :SO2 ), Where( :SO2 > 0.08 ) );
Code Explanation:
- Open data table;
- Create Data Filter object.
- Add filter for Region C and N.
- Set filter mode to Select.
- Hide filter controls.
- Exclude filtered rows from analysis.
- Select SO2, CO, and State columns.
- Match SO2 column values.
- Filter where SO2 > 0.08.
Example 14
Summary: Data filtering and deletion for a specific region and population using the Data Filter function in JMP.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
df = dt << Data Filter(
Add Filter( columns( :Region, :POP ), Where( :Region == {"C", "N"} ) ),
Mode( Select( 0 ), Show( 0 ), Include( 1 ) )
);
df << Delete All;
Code Explanation:
- Open data table;
- Create data filter.
- Add filter for Region and POP.
- Set filter criteria for Region.
- Set filter mode to select.
- Hide filter interface.
- Include filtered rows.
- Delete all filters.
Example 15
Summary: Data filtering and column deletion for a specific dataset, utilizing the Data Filter function to apply conditional filters based on region, state, city, population, and ozone levels.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
df = dt << Data Filter(
Location( {1134, 297} ),
Conditional,
Add Filter(
columns( :city, :State, :Region, :POP, :OZONE ),
Where( :Region == {"MW", "N", "S"} ),
Where( :State == {"AL", "CT", "DC", "DE", "FL", "GA"} ),
Where( :city == {"ATLANTA", "HARTFORD", "JACKSONVILLE", "MIAMI", "MOBILE", "MONTGOMERY", "WASHINGTON"} ),
Where( :POP >= 832.1 & :POP <= 3646 ),
Where( :OZONE >= 0.12 & :OZONE <= 0.161 ),
Display( :city, Size( 204, 174 ), List Display ),
Display( :State, Size( 204, 174 ), List Display ),
Display( :POP ),
Display( :OZONE )
)
);
df << Delete( {:city} );
df << Delete( {:state} );
df << Delete( {:ozone, :SO2} );
df << Delete( {:region} );
Code Explanation:
- Open data table;
- Create data filter.
- Set filter location.
- Define conditional filter.
- Add filter for selected columns.
- Filter by Region values.
- Filter by State values.
- Filter by city values.
- Filter by POP range.
- Filter by OZONE range.
Example 16
Summary: Filters and displays data subsets based on specific conditions, including region, state, city, and lead range.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
df = dt << Data Filter(
Location( {730, 327} ),
Conditional,
Add Filter(
columns( :city, :State, :Region, :Lead ),
Where( :Region == "MW" ),
Where( :State == {"KS", "MI", "MN"} ),
Where( :city == {"DETROIT", "MINNEAPOLIS", "WICHITA"} ),
Where( :Lead >= 0.0606 & :Lead <= 0.24 ),
Display( :city, Size( 204, 174 ), List Display ),
Display( :State, Size( 204, 174 ), List Display ),
Display( :Lead )
)
);
subdt = df << Show Subset;
subMat = subdt << get as matrix;
Code Explanation:
- Open data table.
- Create data filter.
- Set filter location.
- Define conditional filter.
- Add filter criteria for Region.
- Add filter criteria for State.
- Add filter criteria for city.
- Add filter criteria for Lead range.
- Display filtered cities.
- Display filtered states.
- Display filtered Lead.
- Show subset of filtered data.
- Get subset data as matrix.
Example 17
Summary: Runs the filtering and matching process for BP 8W, BP 6M, and BP 12M columns in a data table.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
df = dt << Data Filter( Add Filter( columns( :BP 8W, :BP 6M ) ), Add Filter( columns( :BP 12M ) ) );
df << Match( Filter Columns( :BP 8W, :BP 6M ), Where( :BP 8W > 174.8 & :BP 8W < 184.2 ) );
df << Match( Filter Columns( :BP 12M ), Where( :BP 12M > 181.9 & :BP 12M < 192.1 ) );
Code Explanation:
- Open data table;
- Create data filter object.
- Add first filter for BP 8W and BP 6M.
- Add second filter for BP 12M.
- Set match criteria for BP 8W.
- Set match criteria for BP 12M.
Example 18
Summary: Runs the filtering and matching process to extract specific data from a JMP data table, utilizing Data Filter and Match functions.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
df = dt << Data Filter(
Location( {796, 211} ),
Add Filter( columns( :State, :Region ), Display( :State, Size( 204, 174 ), List Display ) ),
Add Filter( columns( :OZONE, :CO ), Display( :OZONE ), Display( :CO ) )
);
df << Match( Filter Columns( :ozone, :CO ), Where( :ozone > 0.10 & :ozone < 0.15 ) );
df << Match( Filter Columns( :State, :region ), Where( :state == {"AL", "NC", "FL"} ) );
df << Match( Filter Columns( :State, :region ), Where( :region == {"N", "CA"} ) );
Code Explanation:
- Open data table;
- Create data filter.
- Set filter location.
- Add State, Region filter.
- Add OZONE, CO filter.
- Filter OZONE between 0.10 and 0.15.
- Filter State for AL, NC, FL.
- Filter Region for N, CA.
Example 19
Summary: Filtering and selection process for a data table, applying multiple conditions to specific columns and inverting filter selections.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
df = dt << Data Filter(
Location( {219, 400} ),
Add Filter(
columns( :age, :sex, :height, :weight ),
Where( :age == 14 ),
Where( :sex == "F" ),
Where( :height >= 55.8 & :height <= 70 ),
Where( :weight >= 90.7 & :weight <= 172 )
)
);
selRows1 = dt << Get Selected Rows;
df << Inverse( 1 );
selRows2 = dt << Get Selected Rows;
df << Inverse( 0 );
df << (Filter column( :age ) << Invert Selection);
selRows3 = dt << Get Selected Rows;
df << (Filter column( :sex ) << Invert Selection);
selRows4 = dt << Get Selected Rows;
df << (Filter column( :height ) << Invert Selection);
selRows5 = dt << Get Selected Rows;
df << (Filter column( :weight ) << Invert Selection);
selRows6 = dt << Get Selected Rows;
Code Explanation:
- Open data table.
- Create data filter.
- Set filter location.
- Add filter criteria.
- Select rows matching criteria.
- Invert filter selection.
- Select new rows.
- Enable filter again.
- Invert age filter selection.
- Select rows after inverting age.
Example 20
Summary: Creates and applies complex data filters in JMP, utilizing multiple conditions to narrow down a dataset.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
obj = dt << Data Filter( Add( Filter Columns( :Region, :Lead ) ) );
obj << (Filter Column( :Lead ) << Where( :Lead >= .4 & :Lead <= 1.4 ));
txt = obj << get where clause;
obj << Close;
dt << Clear Select;
Eval( Parse( "dt << " || txt ) );
dt << Clear Select;
obj = dt << Data Filter( Add( Filter Columns( :Region, :Lead ) ) );
obj << (Filter Column( :Region ) << Where( :Region == {"C", "MW"} ));
txt = obj << get where clause;
obj << Close;
dt << Clear Select;
Eval( Parse( "dt << " || txt ) );
dt << Clear Select;
Column( "region" )[1] = "";
Column( "region" )[2] = "";
Column( "region" )[3] = "";
Column( "pop" )[1] = .;
Column( "pop" )[2] = .;
Column( "pop" )[3] = .;
obj = dt << Data Filter( Add( Filter Columns( :Region, :Lead ) ) );
obj << (Filter Column( :Region ) << Where( :Region == "" ));
txt = obj << get where clause;
obj << Close;
dt << Clear Select;
Eval( Parse( "dt << " || txt ) );
dt << Clear Select;
Column( "POP" ) << modeling type( "Nominal" );
obj = dt << Data Filter( Add( Filter Columns( :pop ) ) );
obj << (Filter Column( :pop ) << Where( Is Missing( :pop ) ));
txt = obj << get where clause;
obj << Close;
dt << Clear Select;
Eval( Parse( "dt << " || txt ) );
dt << Clear Select;
df = dt << Data Filter(
Location( {319, 249} ),
Add Filter( columns( :city ), Where( :city == {"ALBUQUERQUE", "ATLANTA"} ), Display( :city, Size( 204, 259 ), List Display ) ),
Add Filter(
columns( :Region, :OZONE, :SO2 ),
Where( :Region == {"", "C", "MW", "S", "TX"} ),
Where( :OZONE >= 0.148 & :OZONE <= 0.33 ),
Where( :SO2 >= 0.001 & :SO2 <= 0.058 )
)
);
gwc = df << Get Where Clause;
df << Close;
dt << Clear Select;
Eval( Parse( "dt << " || gwc ) );
Code Explanation:
- Open data table;
- Create Data Filter object.
- Add Region and Lead columns to filter.
- Set Lead filter criteria.
- Retrieve where clause.
- Close Data Filter.
- Clear table selection.
- Apply filter using where clause.
- Clear table selection again.
- Modify Region and POP values for specific rows.
- Create new Data Filter object.
- Set Region filter criteria.
- Retrieve where clause.
- Close Data Filter.
- Clear table selection.
- Apply filter using where clause.
- Clear table selection again.
- Change POP column modeling type to Nominal.
- Create new Data Filter object.
- Set POP missing filter criteria.
- Retrieve where clause.
- Close Data Filter.
- Clear table selection.
- Apply filter using where clause.
- Clear table selection again.
- Create complex Data Filter object with multiple conditions.
- Retrieve where clause.
- Close Data Filter.
- Clear table selection.
- Apply complex filter using where clause.
Example 21
Summary: Data filtering for specific regions in a JMP data table, utilizing the Data Filter function to select and include relevant data.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
obj = dt << Data Filter(
Add Filter( columns( :Region, :POP ), Where( :Region == {"C", "N"} ) ),
Mode( Select( 0 ), Show( 0 ), Include( 1 ) )
);
txt1 = obj << Get Script;
where1 = Char( Arg( Arg( Arg( txt1, 2 ), 3 ), 2 ) );
Code Explanation:
- Open data table;
- Create data filter object.
- Filter Region for C and N.
- Set filter mode to select, show, include.
- Get script from filter object.
- Extract filter condition string.
- Assign extracted string to where1 variable.
Example 22
Summary: Creates a data filter with conditional filtering and checkbox display for the 'age' column, utilizing the Data Filter function.
Code:
dt_df = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
df = dt_df << Data Filter(
Location( {916, 42} ),
conditional( 1 ),
Add Filter( columns( :age ), Display( :age, Size( 160, 90 ), Check Box Display ) )
);
Code Explanation:
- Open data table.
- Create data filter.
- Set filter location.
- Enable conditional filtering.
- Add age column filter.
- Display age as checkbox.
- Set age display size.
Example 23
Summary: Data filtering and display operations to select specific regions from a data table, utilizing the Data Filter function.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter( Add Filter( columns( :Region, :POP ), Where( :Region == {"N"} ) ), Mode( Select( 1 ), Show( 0 ), Include( 0 ) ) );
selrows1 = dt << Get Selected Rows;
df << Display( :Region, Single Category Display );
selrows2 = dt << Get Selected Rows;
Code Explanation:
- Open data table.
- Create data filter object.
- Set filter criteria.
- Apply filter mode.
- Retrieve selected rows.
- Display filtered region.
- Retrieve updated selected rows.
Example 24
Summary: Filters data based on specific conditions, moving the filtered results to a script window and closing the original table.
Code:
dt = Open("data_table.jmp");
obj = dt << Data Filter( Add( Filter Columns( :Region, :Lead ) ) );
obj << (Filter Column( :Region ) << Where( :Region == {"C", "MW"} ));
obj << to Script Window;
obj << Close;
Close( dt, no save );
Window( "Script Window" ) << Close Window;
Code Explanation:
- Open table.
- Create data filter object.
- Add filter columns.
- Set filter condition for Region.
- Move filter to script window.
- Close filter object.
- Close original table.
- Close script window.
Example 25
Summary: Filters and displays data in a JMP data table, applying population and state filters to generate a report.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Add Filter( columns( :POP ), Where( :POP > 1000 & :POP <= 8529 ) ),
Add Filter( columns( :State ), Where( :State == "AL" ), )
);
df << Display( :State, Size( 64, 699 ), Check Box Display );
rep = df << report;
Code Explanation:
- Open data table.
- Create Data Filter object.
- Add population filter: POP > 1000 & POP <= 8529.
- Add state filter: State == "AL".
- Display filter for State column.
- Set display size to 64x699.
- Use checkbox display style.
- Generate filter report.
- Assign report to variable rep.
- End script.
Example 26
Summary: Filters and manipulates a data table by applying favorite filters to specific age and height ranges, adding new rows, and setting row names.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Location( {1038, 125} ),
Add Filter( columns( :age, :height ) ),
Favorites(
"sex = M"(Match( columns( :sex ), Where( :sex == "M" ) )),
"age = 12, 14, 16 and :height >= 58.93 & :height <= 70"(Match( columns( :age, :height ),
Where( :age == {12, 14, 16} ), Where( :height >= 58.93 & :height <= 70 )
))
)
);
df << Apply Favorites( "age = 12, 14, 16 and :height >= 58.93 & :height <= 70" );
dt << Add Rows( 1 );
dt:name[41] = "Penelope";
Code Explanation:
- Open data table;
- Create Data Filter object.
- Set filter location.
- Add filter for age and height columns.
- Define favorite filter for sex = M.
- Define favorite filter for specific age and height range.
- Apply the specific age-height favorite filter.
- Add a new row to the table.
- Set name of new row to "Penelope".
Example 27
Summary: Data filtering and row manipulation in a JMP data table, adding a new row with a specified name.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter( Location( {232, 142} ), Add Filter( columns( :sex ), Where( :sex == "M" ) ), Mode( Show( 1 ), Include( 1 ) ) );
dt << Add Rows( 1 );
dt:name[41] = "VALENTINA";
Code Explanation:
- Open data table;
- Create data filter.
- Set filter location.
- Add filter for sex.
- Set filter mode.
- Add new row to table.
- Assign name to new row.
Example 28
Summary: Filtering and selection process for a data table, allowing users to dynamically filter rows based on specific conditions and retrieve selected rows.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Location( {437, 194} ),
Add Filter(
columns( :Brush Delimited ),
Match All( Where( :Brush Delimited == {"Before Sleep", "Wake"} ) ),
Display( :Brush Delimited, Size( 121, 70 ), Check Box Display )
)
);
selRows = dt << Get Selected Rows;
df << Add Favorites( "All" );
df << Delete All;
df << Apply Favorites( "All" );
selRows2 = dt << Get Selected Rows;
Code Explanation:
- Open data table.
- Create data filter.
- Set filter location.
- Add filter condition.
- Specify filter columns.
- Define match criteria.
- Display filter options.
- Retrieve selected rows.
- Save filter settings.
- Clear all filters.
- Apply saved filter.
- Retrieve new selected rows.
Example 29
Summary: Runs the filtering process for a specific column in a data table, allowing users to match none, any, exactly, or only checked items.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Location( {437, 194} ),
Add Filter(
columns( :Brush Delimited ),
Match None( Where( :Brush Delimited == {"Before Sleep", "Wake"} ) ),
Display( :Brush Delimited, Size( 121, 70 ), Check Box Display )
)
);
df << (Filter Column( :Brush Delimited ) << Match Any of the Checked Items( Where( :Brush Delimited == {"Other", "Wake"} ) ));
df << (Filter Column( :Brush Delimited ) << Match none of the Checked Items( Where( :Brush Delimited == {"Before Sleep", "Wake"} ) ));
df << (Filter Column( :Brush Delimited ) << Match Exactly the Checked Items( Where( :Brush Delimited == {"Other", "Wake"} ) ));
df << (Filter Column( :Brush Delimited ) << Match Only the Checked Items( Where( :Brush Delimited == {"Before Sleep", "Wake"} ) ));
df << (Filter Column( :Brush Delimited ) << Match All of the Checked Items( Where( :Brush Delimited == {"Other", "Wake"} ) ));
Code Explanation:
- Open data table;
- Create data filter.
- Set filter location.
- Add filter for Brush Delimited.
- Match none of checked items.
- Display filter column.
- Match any of checked items.
- Match none of checked items.
- Match exactly checked items.
- Match only checked items.
Example 30
Summary: Data filtering and column deletion operations on a JMP data table, utilizing the Data Filter function to refine the dataset.
Code:
dt = Open("data_table.jmp");
obj = dt << Data Filter(
Add Filter( columns( :Region, :POP ), Where( :Region == {"C", "N"} ) ),
Mode( Select( 0 ), Show( 0 ), Include( 1 ) )
);
obj << Delete( {:Region} );
obj << Delete( {:Pop, :city} );
obj << Delete( {} );
obj << Delete();
Code Explanation:
- Open data table;
- Create Data Filter object.
- Add filter for Region C and N.
- Set filter mode to select, hide, include.
- Delete Region column from filter.
- Delete Pop and city columns from filter.
- Delete unnamed column from filter.
- Delete filter object.
Example 31
Summary: Data filtering by adding a filter to the 'age' and 'sex' columns, extracting the script for further use.
Code:
dt = Open("data_table.jmp");
obj = dt << Data Filter( Add Filter( columns( :age, :sex ) ) );
s = Char( obj << Get Script );
Code Explanation:
- Open data table;
- Create data filter object.
- Add age and sex columns filter.
- Get script for filter object.
Example 32
Summary: Data filtering and report generation by applying conditional filters to a data table, specifying filter columns, and deleting a column.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Location( {204, 114} ),
Conditional,
Add Filter( columns( :name, :age, :sex ), Display( :name, Size( 204, 174 ), List Display ), Display( :sex, List Display ) )
);
df << (Filter Column( :sex ) << Where( :sex == "M" ));
df << (Filter Column( :age ) << Where( :age == 14 ));
df << (Filter Column( :name ) << Where( :name == {"ALFRED", "CHRIS"} ));
df << Delete( {:name} );
rep = df << report;
Code Explanation:
- Open data table;
- Create data filter.
- Set filter location.
- Add conditional filter.
- Specify filter columns.
- Display name column.
- Display sex column.
- Filter by sex "M".
- Filter by age 14.
- Filter by names "ALFRED", "CHRIS".
- Delete name column.
- Generate report.
Example 33
Summary: Data filtering by adding a filter column for Region and Lead, then setting the Region filter to C and MW.
Code:
dt = Open("data_table.jmp");
obj = dt << Data Filter( Add( Filter Columns( :Region, :Lead ) ) );
obj << (Filter Column( :Region ) << Where( :Region == {"C", "MW"} ));
obj << to Script Window;
Code Explanation:
- Open data table.
- Create data filter object.
- Add filter columns: Region, Lead.
- Set Region filter to C, MW.
- Display filter script in window.
Example 34
Summary: Data filtering and matching operations to extract specific rows from a JMP data table, utilizing the Data Filter and Match functions.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter( Add Filter( columns( :age, :weight ) ), Add Filter( columns( :height ) ), Mode( Select( 1 ) ) );
df << Match( Where( :sex == "F" ) );
Code Explanation:
- Open data table.
- Create data filter object.
- Add filter for age and weight.
- Add filter for height.
- Set filter mode to select.
- Apply filter to first condition.
- Match rows where sex is female.
Example 35
Summary: Filters and selects data rows based on specific conditions, including age range and gender.
Code:
dt_df2 = Open("data_table.jmp");
df = dt_df2 << Data Filter(
Location( {916, 42} ),
conditional( 0 ),
Add Filter( columns( :sex ), Display( :age, Size( 160, 90 ), List Display ) )
);
df << Add Filter( columns( :age ) );
obj = dt_df2 << Select Where( (:age == 16 | :age == 17) & :sex == "M" );
df = obj << get row states;
Code Explanation:
- Open data table;
- Create data filter object.
- Set filter location.
- Initialize filter conditions.
- Add sex filter column.
- Display age list for sex.
- Add age filter column.
- Select rows where age is 16 or 17.
- Filter rows by male gender.
- Retrieve selected row states.
Example 36
Summary: Data filtering and reporting by selecting specific regions and populations, then generating a report from the filtered data.
Code:
dt2 = Open("data_table.jmp");
dfWin = dt2 << Data Filter(
Add Filter( columns( :Region, :POP ), Where( :Region == {"C", "N"} ) ),
Mode( Select( 0 ), Show( 0 ), Include( 1 ) )
);
regionobj = dfWin << Get Filter Column( :Region );
regionobj << Find( Set Text( "w" ) );
reprt = dfWin << report;
Code Explanation:
- Open data table;
- Create data filter window.
- Add filter for Region and POP columns.
- Set filter mode to Select, Show, Include.
- Get Region filter object.
- Find text "w" in Region filter.
- Generate report from filtered data.
Example 37
Summary: Data filtering and row state management for a JMP data table, utilizing the Data Filter function to apply conditions and set filter visibility.
Code:
dt = Open("data_table.jmp");
obj = dt << Data Filter(
invisible,
Add Filter( columns( :Region, :POP ), Where( :Region == {"C", "N"} ) ),
Mode( Select( 0 ), Show( 0 ), Include( 1 ) )
);
If( Host is( Windows ),
ws = Window( "Data Filter for data_table" ) << get window size()
);
rs = dt << get row states;
Code Explanation:
- Open table.
- Create data filter.
- Set filter visibility.
- Add filter conditions.
- Set filter mode.
- Check host OS.
- Get window size (Windows).
- Get row states.
Example 38
Summary: Data filtering by adding a filter to a data table, selecting specific rows for analysis, and hiding the filter interface.
Code:
dt = Open("data_table.jmp");
obj = dt << Data Filter( Add Filter(), Mode( Select( 0 ), Show( 0 ), Include( 1 ) ) );
Code Explanation:
- Open data table.
- Create data filter object.
- Add filter to data table.
- Set filter mode to select.
- Hide filter interface.
- Include filtered rows in analysis.
Example 39
Summary: Data filtering to extract specific records from a data table, utilizing the Data Filter object and conditional statements.
Code:
dt = Open("data_table.jmp");
obj = dt << Data Filter();
obj << Add Filter( columns( :POP ), Where( :POP > 1000 ) );
obj << Add Filter( columns( :Region, :State, :City ), Where( :Region == "S" ), Where( :State == {"SC", "NC"} ) );
Code Explanation:
- Open data table;
- Create data filter object.
- Add population filter.
- Add region filter.
- Add state filter.
- Apply city filter.
Example 40
Summary: Runs the filtering and row state management of a data table based on age criteria, enabling interactive selection and display control.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter( Add Filter( columns( :age ), Where( :age >= 31.86 & :age <= 60 ) ), Mode( Select( 0 ), Show( 0 ), Include( 1 ) ) );
rs = dt << get row states;
df << Mode( Select( 1 ), Show( 1 ), Include( 1 ) );
rs = dt << get row states;
df << Mode( Select( 0 ), Show( 0 ), Include( 0 ) );
rs = dt << get row states;
df << Mode( Select( 0 ), Show( 1 ), Include( 0 ) );
rs = dt << get row states;
df << Mode( Select( 1 ), Show( 0 ), Include( 0 ) );
rs = dt << get row states;
df << Mode( Select( 1 ), Show( 1 ), Include( 0 ) );
rs = dt << get row states;
df << Mode( Select( 0 ), Show( 1 ), Include( 1 ) );
rs = dt << get row states;
Code Explanation:
- Open data_table data
- Create age filter.
- Get initial row states.
- Enable filter selection.
- Get updated row states.
- Disable filter selection.
- Get updated row states.
- Disable filter display.
- Get updated row states.
- Enable filter display.
Example 41
Summary: Filters data based on specific State and Region conditions, displaying the filtered results in a list format.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Location( {673, 234} ),
Add Filter(
columns( :State, :Region ),
Where( :State == {"AL", "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA"} ),
Where( :Region == {"MW", "N", "S"} ),
Display( :State, Size( 204, 174 ), List Display )
)
);
fr = df << Get Filtered Rows( 1 );
Code Explanation:
- Open data table.
- Create data filter.
- Set filter location.
- Add filter criteria.
- Specify State column.
- Define State conditions.
- Specify Region column.
- Define Region conditions.
- Display State filter.
- Retrieve filtered rows.
Example 42
Summary: Runs the filtering and animation of a data table based on Region and POP, generating a report with interactive buttons.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Add Filter( columns( :Region, :POP ), Where( :Region == {"C", "N"} ) ),
Mode( Select( 0 ), Show( 0 ), Include( 1 ) )
);
df << Columns( :Region );
df << Animation( Animate Column( :Region ), Bounce );
rep = df << report;
rep[Button Box( 5 )] << Click;
rep[Button Box( 7 )] << Click;
Code Explanation:
- Open data table;
- Create data filter.
- Set filter criteria for Region.
- Set filter criteria for POP.
- Apply filter mode settings.
- Select Region column for animation.
- Animate Region column.
- Generate filter report.
- Click on button box 5.
- Click on button box 7.
Example 43
Summary: Data filtering and reporting for a specific region, utilizing the Data Filter function to select relevant data and generate a report.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Add Filter( columns( :Region, :POP ), Where( :Region == {"C", "N"} ) ),
Mode( Select( 0 ), Show( 0 ), Include( 1 ) )
);
rep = df << report;
df << Close;
Code Explanation:
- Open data table.
- Create data filter object.
- Add filter for Region and POP columns.
- Set filter condition for Region.
- Configure filter mode.
- Generate filter report.
- Close data filter window.
Example 44
Summary: Data filtering and matching operations to extract specific rows from a data table, utilizing the Data Filter and Match functions.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Add Filter( columns( :Region, :POP ), Where( :Region == {"C", "N"} ) ),
Mode( Select( 1 ), Show( 0 ), Include( 0 ) )
);
df << Columns( :SO2, :CO, :State );
df << Match( Filter Columns( :SO2 ), Where( :SO2 > 0.08 ) );
Code Explanation:
- Open data table.
- Create data filter object.
- Add filter for Region and POP columns.
- Set filter mode to select.
- Hide filter interface.
- Exclude filtered rows.
- Add SO2, CO, State to filter.
- Match filter columns to SO2.
- Apply condition: SO2 > 0.08.
Example 45
Summary: Runs the filtering and deletion process for a data table, selecting rows where Region is 'C' or 'N', and then deleting all filters.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Add Filter( columns( :Region, :POP ), Where( :Region == {"C", "N"} ) ),
Mode( Select( 0 ), Show( 0 ), Include( 1 ) )
);
df << Delete All;
Code Explanation:
- Open data table;
- Create data filter.
- Add filter for Region "C" and "N".
- Set filter mode to select all.
- Hide filter panel.
- Include filtered rows.
- Delete all filters.
Example 46
Summary: Data filtering and column deletion for a specific dataset, utilizing the Data Filter function to apply conditional criteria.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Location( {1134, 297} ),
Conditional,
Add Filter(
columns( :city, :State, :Region, :POP, :OZONE ),
Where( :Region == {"MW", "N", "S"} ),
Where( :State == {"AL", "CT", "DC", "DE", "FL", "GA"} ),
Where( :city == {"ATLANTA", "HARTFORD", "JACKSONVILLE", "MIAMI", "MOBILE", "MONTGOMERY", "WASHINGTON"} ),
Where( :POP >= 832.1 & :POP <= 3646 ),
Where( :OZONE >= 0.12 & :OZONE <= 0.161 ),
Display( :city, Size( 204, 174 ), List Display ),
Display( :State, Size( 204, 174 ), List Display ),
Display( :POP ),
Display( :OZONE )
)
);
df << Delete( {:city} );
df << Delete( {:state} );
df << Delete( {:ozone, :SO2} );
df << Delete( {:region} );
Code Explanation:
- Open data table.
- Create Data Filter object.
- Set filter location.
- Define conditional filtering.
- Add filter criteria for Region.
- Add filter criteria for State.
- Add filter criteria for city.
- Add filter criteria for POP range.
- Add filter criteria for OZONE range.
- Delete selected columns from filter.
Example 47
Summary: Filters and displays data based on population and state criteria, generating a report with checkbox displays.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Location( {678, 183} ),
Add Filter( columns( :POP ), Where( :pop > 1000 ) ),
Add Filter( columns( :State ), Where( :State == "AL" ) )
);
df << Display( :state, Check box Display );
dfrep = df << Report;
Code Explanation:
- Open data table.
- Create Data Filter object.
- Set filter location.
- Add population filter: POP > 1000.
- Add state filter: State == "AL".
- Display state filter as checkbox.
- Generate filter report.
Example 48
Summary: Filters and subsets data based on specific conditions, including Region, State, city, and Lead range, to generate a matrix representation of the filtered data.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Location( {730, 327} ),
Conditional,
Add Filter(
columns( :city, :State, :Region, :Lead ),
Where( :Region == "MW" ),
Where( :State == {"KS", "MI", "MN"} ),
Where( :city == {"DETROIT", "MINNEAPOLIS", "WICHITA"} ),
Where( :Lead >= 0.0606 & :Lead <= 0.24 ),
Display( :city, Size( 204, 174 ), List Display ),
Display( :State, Size( 204, 174 ), List Display ),
Display( :Lead )
)
);
subdt = df << Show Subset;
subMat = subdt << get as matrix;
Code Explanation:
- Open data table.
- Create data filter object.
- Set filter location.
- Define conditional filter.
- Add filter criteria for Region.
- Add filter criteria for State.
- Add filter criteria for city.
- Add filter criteria for Lead range.
- Display filtered city in list.
- Display filtered State in list.
- Display filtered Lead.
- Show subset of filtered data.
- Convert subset to matrix.
Example 49
Summary: Runs the filtering and matching process for BP 8W, BP 6M, and BP 12M columns in a data table.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter( Add Filter( columns( :BP 8W, :BP 6M ) ), Add Filter( columns( :BP 12M ) ) );
df << Match( Filter Columns( :BP 8W, :BP 6M ), Where( :BP 8W > 174.8 & :BP 8W < 184.2 ) );
df << Match( Filter Columns( :BP 12M ), Where( :BP 12M > 181.9 & :BP 12M < 192.1 ) );
Code Explanation:
- Open data table;
- Create Data Filter object.
- Add first filter for BP 8W and BP 6M.
- Add second filter for BP 12M.
- Match BP 8W filter criteria.
- Match BP 6M filter criteria.
- Match BP 12M filter criteria.
Example 50
Summary: Filters and matches data in a JMP script, utilizing Data Filter and Match functions to narrow down the dataset based on specific conditions.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Location( {796, 211} ),
Add Filter( columns( :State, :Region ), Display( :State, Size( 204, 174 ), List Display ) ),
Add Filter( columns( :OZONE, :CO ), Display( :OZONE ), Display( :CO ) )
);
df << Match( Filter Columns( :ozone, :CO ), Where( :ozone > 0.10 & :ozone < 0.15 ) );
df << Match( Filter Columns( :State, :region ), Where( :state == {"AL", "NC", "FL"} ) );
df << Match( Filter Columns( :State, :region ), Where( :region == {"N", "CA"} ) );
Code Explanation:
- Open data table;
- Create data filter.
- Set filter location.
- Add filter for State and Region.
- Add filter for OZONE and CO.
- Match ozone levels between 0.10 and 0.15.
- Match states AL, NC, FL.
- Match regions N, CA.
- Apply filters.
- Display filtered data.
Example 51
Summary: Filters and selects rows in a data table based on specific conditions, including age, sex, height, and weight.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Location( {219, 400} ),
Add Filter(
columns( :age, :sex, :height, :weight ),
Where( :age == 14 ),
Where( :sex == "F" ),
Where( :height >= 55.8 & :height <= 70 ),
Where( :weight >= 90.7 & :weight <= 172 )
)
);
selRows1 = dt << Get Selected Rows;
df << Inverse( 1 );
selRows2 = dt << Get Selected Rows;
df << Inverse( 0 );
df << (Filter column( :age ) << Invert Selection);
selRows3 = dt << Get Selected Rows;
df << (Filter column( :sex ) << Invert Selection);
selRows4 = dt << Get Selected Rows;
df << (Filter column( :height ) << Invert Selection);
selRows5 = dt << Get Selected Rows;
df << (Filter column( :weight ) << Invert Selection);
selRows6 = dt << Get Selected Rows;
Code Explanation:
- Open data table.
- Create data filter.
- Set filter location.
- Add filter for age, sex, height, weight.
- Filter where age equals 14.
- Filter where sex equals "F".
- Filter where height between 55.8 and 70.
- Filter where weight between 90.7 and 172.
- Get selected rows after initial filter.
- Invert filter settings.
- Get selected rows after inverting.
- Invert age filter selection.
- Get selected rows after inverting age.
- Invert sex filter selection.
- Get selected rows after inverting sex.
- Invert height filter selection.
- Get selected rows after inverting height.
- Invert weight filter selection.
- Get selected rows after inverting weight.
Example 52
Summary: Filters a data table to include only North, South, and West regions, extending the initial filter for further analysis.
Code:
dt = Open("data_table.jmp");
obj = dt << Data Filter( Add( Filter Columns( :Region ), Where( :Region = {"N", "S"} ) ) );
obj << (Filter Column( :Region ) << Extend Where( :Region = "W" ));
Code Explanation:
- Open data table;
- Create data filter object.
- Add Region filter column.
- Set initial filter for North and South.
- Extend filter to include West region.
Example 53
Summary: Data filtering and extraction by applying a filter to the 'Region' and 'POP' columns, then retrieving and processing the script from the Data Filter object.
Code:
dt = Open("data_table.jmp");
obj = dt << Data Filter(
Add Filter( columns( :Region, :POP ), Where( :Region == {"C", "N"} ) ),
Mode( Select( 0 ), Show( 0 ), Include( 1 ) )
);
txt1 = obj << Get Script;
where1 = Char( Arg( Arg( Arg( txt1, 2 ), 3 ), 2 ) );
Code Explanation:
- Open data table.
- Create Data Filter object.
- Add filter for Region and POP columns.
- Set filter criteria: Region == {"C", "N"}.
- Configure filter mode: Select, Show, Include.
- Retrieve script from Data Filter object.
- Extract second argument from script.
- Extract third argument from nested structure.
- Convert extracted argument to character string.
- Assign result to where1 variable.
Example 54
Summary: Creates and manipulates data filters in JMP to analyze specific conditions, utilizing interactive features like Check Box Display and Local Data Filters.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Location( {437, 50} ),
Add Filter(
columns( :Brush Delimited ),
Match None( Where( :Brush Delimited == {"Before Sleep", "Wake"} ) ),
Display( :Brush Delimited, Size( 121, 70 ), Check Box Display )
)
);
df << Delete( :Brush Delimited );
text1 = df << get script;
If( Host is( windows ),
Window( "Data Filter for data_table" ) << Close Window,
repDF = df << report;
repDf << Close Window;
);
df = dt << Data Filter(
Location( {437, 50} ),
Add Filter(
columns( :Brush Delimited ),
Match None( Where( :Brush Delimited == {"Before Sleep", "Wake"} ) ),
Display( :Brush Delimited, Size( 121, 70 ), Check Box Display )
)
);
df << Delete( {:Brush Delimited} );
text2 = df << Get script;
If( Host is( windows ),
Window( "Data Filter for data_table" ) << Close Window,
repDF = df << report;
repDf << Close Window;
);
df2 = dt << Data Filter(
Location( {437, 90} ),
Add Filter(
columns( :Brush Delimited, :Age in Years ),
Match None( Where( :Brush Delimited == {"Before Sleep", "Wake"} ) ),
Where( :Age in Years >= 33.3 & :Age in Years <= 74 ),
Display( :Brush Delimited, Size( 117, 66 ), Check Box Display )
)
);
df2 << Delete( :Brush Delimited );
Code Explanation:
- Open data table;
- Create data filter.
- Set filter location.
- Add filter column.
- Match none where conditions.
- Display filter settings.
- Delete filter column.
- Get filter script.
- Check if host is Windows.
- Close data filter window.
- Repeat steps 2-10.
- Create second data filter.
- Set second filter location.
- Add second filter columns.
- Match none where conditions.
- Apply age range condition.
- Display second filter settings.
- Delete second filter column.
Example 55
Summary: Creates a data filter object with multiple filtering criteria, including adding filters and configuring mode to select all rows.
Code:
dt = Open("data_table.jmp");
obj = dt << Data Filter( Add Filter(), Mode( Select( 0 ), Show( 0 ), Include( 1 ) ) );
obj = dt << Data Filter( Add Filter() );
Code Explanation:
- Open data table.
- Create data filter object.
- Configure filter mode to select all.
- Hide filter interface initially.
- Include all rows in filter.
- Add another filter to data table.
Example 56
Summary: Filtering and selection process for a specific column in a data table, utilizing Data Filter and Get Selected Rows functions.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Location( {437, 194} ),
Add Filter(
columns( :Brush Delimited ),
Match None( Where( :Brush Delimited == {"Before Sleep", "Wake"} ) ),
Display( :Brush Delimited, Size( 121, 70 ), Check Box Display )
)
);
selRows = dt << Get Selected Rows;
df << Inverse( 1 );
selRows2 = dt << Get Selected Rows;
df << Inverse( 0 );
selRows3 = dt << Get Selected Rows;
df << (filter column( :Brush Delimited ) << Invert Selection);
selRows4 = dt << Get Selected Rows;
Code Explanation:
- Open data table.
- Create data filter.
- Set filter location.
- Add filter for "Brush Delimited".
- Exclude "Before Sleep" and "Wake".
- Display filter with checkbox.
- Get selected rows.
- Invert filter selection.
- Get selected rows again.
- Invert filter selection again.
- Invert selection of "Brush Delimited".
- Get final selected rows.
Example 57
Summary: Filters and selects rows in a data table based on specific criteria, utilizing Data Filter and Add Filter functions.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter(
Location( {566, 71} ),
Add Filter(
columns( :Floss Delimited ),
Match At Most( 1, Where( :Floss Delimited == {"After Meal", "Other", Is Missing( :Floss Delimited ), "Before Sleep", "Wake"} ) ),
Display( :Floss Delimited, Size( 121, 87 ), Check Box Display )
)
);
selRowsAtMost = dt << get selected rows;
stdSelRowsAtMost = dt << get rows where(
:Floss delimited == "After Meal," | :Floss delimited == "Other" | :Floss delimited == "Before Sleep," | :Floss delimited == "Wake," |
Is Missing( :Floss Delimited )
);
df << Delete( {:Floss Delimited} );
df << Add Filter(
columns( :Floss Delimited ),
Match At Most( 0, Where( :Floss Delimited == {"After Meal", "Before Sleep", "Other", "Wake"} ) ),
Display( :Floss Delimited, Size( 121, 87 ), Check Box Display )
);
selRowsAtMost0 = dt << get selected rows;
stdSelRowsAtMost0 = dt << get rows where( Is Missing( :Floss Delimited ) );
df << Delete( {:Floss Delimited} );
df << Add Filter(
columns( :Floss Delimited ),
Match At Most( 5, Where( :Floss Delimited == {"After Meal", "Before Sleep", "Other", "Wake"} ) ),
Display( :Floss Delimited, Size( 121, 87 ), Check Box Display )
);
selRowsAtMost5 = dt << get selected rows;
stdSelRowsAtMost5 = dt << get rows where(
Contains( :Floss delimited, "After Meal" ) | Contains( :Floss delimited, "Other" ) | Contains( :Floss delimited, "Before Sleep" ) |
Contains( :Floss delimited, "Wake" ) | Is Missing( :Floss Delimited )
);
df << Delete( {:Floss Delimited} );
df << Add Filter(
columns( :Floss Delimited ),
Match At Most( ., Where( :Floss Delimited == {"After Meal", "Before Sleep", "Other", "Wake"} ) ),
Display( :Floss Delimited, Size( 121, 87 ), Check Box Display )
);
selRowsAtMostMiss = dt << get selected rows;
Code Explanation:
- Open data table;
- Create data filter.
- Set filter location.
- Add filter for Floss Delimited.
- Select rows matching criteria.
- Get standard selected rows.
- Remove Floss Delimited from filter.
- Add new filter for Floss Delimited.
- Select rows matching criteria.
- Get standard selected rows.
Example 58
Summary: Data filtering by adding a filter to the data table, selecting specific rows based on conditions.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", invisible );
dt << Data Filter();
Code Explanation:
- Open data table.
- Make data table invisible.
- Add data filter.
Example 59
Summary: Selects and filters data rows based on specific conditions in a JMP data table, utilizing Data Filter and Match functions.
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];
Code Explanation:
- Open data table;
- Create data filter object.
- Add filter for BP 8W and BP 6M.
- Add filter for BP 12M.
- Set match criteria for BP 8W.
- Set match criteria for BP 12M.
- Activate first filter mode.
- Retrieve selected rows.
- Define certified row list.
Example 60
Summary: Runs a series of data manipulation tasks, including filtering, column management, and table variable creation.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter( Location( {632, 143} ), Add Filter( columns( :age ), Where( :age == 13 ) ), Mode( Include( 1 ), Select( 1 ) ) );
df << (filter column( :age ) << invert selection);
dt << Get Row States;
Close( dt, nosave );
dt = New Table( "Table Variable Problem" );
dt << New Table Variable( "Variable", . );
Close( dt, nosave );
dt1 = New Table( "Table 1" );
dt2 = New Table( "Table 2" );
c2 = Char( Current Data Table() );
dt1 << Bring Window To Front;
c1 = Char( Current Data Table() );
Close( dt2, nosave );
Close( dt1, nosave );
dt = New Table( "Distribution Timing" );
dt << begin data update;
dt << add rows( 2000 );
dt << begin data update;
For( i = 1, i <= 50, i++,
c = dt << New Column( "Column" || Char( i ), numeric, formula( Random Normal() ) );
c << eval formula;
);
dt << delete column( Column( 1 ) );
dt << end data update;
Close( dt, nosave );
dt = New Table( "Table Variable Problem" );
dt << New Table Variable( "Variable", . );
Code Explanation:
- Open data table;
- Create data filter.
- Set filter for age 13.
- Invert age filter selection.
- Get row states.
- Close "data_table.jmp".
- Create new table "Table Variable Problem".
- Add table variable.
- Close "Table Variable Problem".
- Create "Table 1" and "Table 2".
- Get current data table name.
- Bring "Table 1" to front.
- Get current data table name again.
- Close "Table 2".
- Close "Table 1".
- Create new table "Distribution Timing".
- Begin data update.
- Add 2000 rows.
- Begin another data update.
- Loop 50 times.
- Create new columns with random normal data.
- Evaluate formulas.
- Delete first column.
- End data update.
- Close "Distribution Timing".
- Create new table "Table Variable Problem".
- Add table variable.
Example 61
Summary: Data filtering and row state retrieval by applying a filter to a specific location, adding an age filter with a condition, and inverting the selection.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter( Location( {632, 143} ), Add Filter( columns( :age ), Where( :age == 13 ) ), Mode( Include( 1 ), Select( 1 ) ) );
df << (filter column( :age ) << invert selection);
dt << Get Row States;
Code Explanation:
- Open data table;
- Create data filter.
- Set filter location.
- Add age filter.
- Set filter condition.
- Apply filter mode.
- Invert age selection.
- Retrieve row states.
Example 62
Summary: Data filtering by opening a data table, adding a filter with specific conditions, and setting preferences for the filter.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter( Add Filter( columns( :Name( "1972" ) ), Where( ::Name( "1972" ) > .53 & :Name( "1972" ) < .62 ), ) );
Close( dt, nosave );
Preferences( Data Filter Select Check( 1 ), Data Filter Show Check( 0 ), Data Filter Include Check( 1 ) );
Code Explanation:
- Open table.
- Add data filter.
- Set filter conditions.
- Close table without saving.
- Set preferences for data filter.
Example 63
Summary: Data filtering and configuration settings in JMP, opening a data table, applying a filter with specific conditions, and closing the table without saving.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter( Add Filter( columns( :Name( "1972" ) ), Where( :Name( "1972" ) > .53 & :Name( "1972" ) < .62 ), ) );
Close( dt, nosave );
Preferences( Data Filter Select Check( 0 ), Data Filter Show Check( 1 ), Data Filter Include Check( 1 ) );
Code Explanation:
- Open data table.
- Apply data filter.
- Close table without saving.
- Set data filter select check off.
- Set data filter show check on.
- Set data filter include check on.
Example 64
Summary: Data filtering and preference settings for a specific column range in a JMP data table.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter( Add Filter( columns( :Name( "1972" ) ), Where( :Name( "1972" ) > .53 & :Name( "1972" ) < .62 ), ) );
Close( dt, nosave );
Preferences( Data Filter Select Check( 0 ), Data Filter Show Check( 0 ), Data Filter Include Check( 1 ) );
Code Explanation:
- Open data table;
- Create data filter.
- Add filter on column "1972".
- Set filter conditions.
- Close table without saving.
- Set preferences for data filter.
- Disable select check.
- Disable show check.
- Enable include check.
Example 65
Summary: Filters and closes a data table, while also setting Excel label preferences.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter( Add Filter( columns( :Name( "1972" ) ), Where( :Name( "1972" ) > .53 & :Name( "1972" ) < .62 ), ) );
Close( dt, nosave );
final prefs = Get Preferences();
initial preferences = Get Preferences();
Preference( Excel Has Labels( 1 ), Use Excel Labels as Headings( 1 ) );
Code Explanation:
- Open table.
- Apply data filter.
- Close table without saving.
- Save initial preferences.
- Save initial preferences again.
- Set Excel label preference.
Example 66
Summary: Data filtering for the '1972' column in a JMP data table, applying conditions to select values between 0.53 and 0.62.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter( Add Filter( columns( :Name( "1972" ) ), Where( ::Name( "1972" ) > .53 & :Name( "1972" ) < .62 ), ) );
Code Explanation:
- Open data table;
- Create data filter.
- Add filter for "1972" column.
- Set filter condition: "1972" > 0.53.
- Set filter condition: "1972" < 0.62.
Example 67
Summary: Data filtering by applying a conditional statement to select specific rows from the 'data_table.jmp' dataset, utilizing the Data Filter function.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter( Add Filter( columns( :Name( "1972" ) ), Where( :Name( "1972" ) > .53 & :Name( "1972" ) < .62 ), ) );
Code Explanation:
- Open table.
- Apply data filter.
Data Filter using New Window
Example 1
Summary: Creates a local filter window in JMP, filtering data based on specific conditions for POP, SO2, and OZONE columns.
Code:
dt = Open("data_table.jmp");
w = New Window( "local filter",
df = dt << Data Filter(
Conditional,
Local,
Add Filter(
columns( :POP, :OZONE, :SO2 ),
Where( :POP >= 3497.5 & :POP <= 8529 ),
Where( :SO2 >= 0.033 & :SO2 <= 0.083 ),
Where( :OZONE >= 0.16 & :OZONE <= 0.21 )
)
)
);
(df << Get Filter Column( :OZONE )) << Where( :OZONE >= 0.17 & :OZONE <= 0.21 );
Code Explanation:
- Open data table.
- Create new window "local filter".
- Add Data Filter to window.
- Set filter type to Conditional.
- Enable local filtering.
- Add filter for POP column.
- Set POP filter criteria.
- Add filter for SO2 column.
- Set SO2 filter criteria.
- Modify OZONE filter criteria.
Example 2
Summary: Creates a custom window with data filtering and multiple script execution for bivariate and contingency analysis.
Code:
dt = Open("data_table.jmp");
win = New Window( "filter",
Data Filter Context Box(
V List Box(
Text Box( "Custom Window" ),
H List Box(
dt << Data Filter( Local, Add Filter( columns( :height ), Where( :height >= 58.577 & :height <= 70 ) ) ),
H Splitter Box(
Size( 1000, 500 ),
Tab Page Box( "Bivariate", Scroll Box( Size( 500, 500 ), dt << Run Script( "Bivariate" ) ) ),
Tab Page Box( "Contingency", Scroll Box( Size( 500, 500 ), dt << Run Script( "Contingency" ) ) ),
)
)
)
)
);
win << Save Window Report( "$TEMP/customwindow.jrp", embed data( 0 ) );
win << Close Window;
Code Explanation:
- Open data table;
- Create new window "filter".
- Add data filter context box.
- Add vertical list box.
- Add text box "Custom Window".
- Add horizontal list box.
- Apply height filter (58.577 to 70).
- Add horizontal splitter box.
- Add tab page "Bivariate" with scroll box.
- Run Bivariate script.
- Add tab page "Contingency" with scroll box.
- Run Contingency script.
- Save window report to "$TEMP/customwindow.jrp".
- Close window.
Example 3
Summary: Creates a custom window with data filtering, bivariate and contingency analysis, and report saving.
Code:
dt = Open("data_table.jmp");
win = New Window( "filter",
Data Filter Context Box(
V List Box(
Text Box( "Custom Window" ),
H List Box(
dt << Data Filter( Local, Add Filter( columns( :height ), Where( :height >= 58.577 & :height <= 70 ) ) ),
H Splitter Box(
Size( 1000, 500 ),
Tab Page Box(
"Bivariate",
Scroll Box(
Size( 500, 500 ),
dt << Run Script( "Bivariate" ),
<<Set Stretch( "Window", "Window" ),
<<Set Max Size( 1000, 1000 )
)
),
Tab Page Box(
"Contingency",
Scroll Box( Size( 500, 500 ), dt << Run Script( "Contingency" ), <<Set Max Size( 1000, 1000 ) )
),
)
)
)
)
);
win << Save Window Report( "$TEMP/customwindow.jrp", embed data( 0 ) );
win << Close Window;
Open( "$TEMP/customwindow.jrp" );
Code Explanation:
- Open data table;
- Create new window titled "filter".
- Add data filter context box.
- Display "Custom Window" text.
- Apply height filter (>=58.577 & <=70).
- Create horizontal splitter box.
- Add "Bivariate" tab page.
- Run Bivariate script on dataset.
- Add "Contingency" tab page.
- Run Contingency script on dataset.
- Save window report to temporary file.
- Close the window.
- Open saved window report.
Data Filter using Function
Summary: Creates a data filter for a specific range of values in a JMP data table, utilizing local filtering and conditional statements.
Code:
frameExtents = Function( {frame},
{DefaultLocal},
hist = frame << Find Seg( Hist Seg( 1 ) );
jrn = hist << Get Journal;
orig = Substr( jrn, Contains( jrn, "scaleOrig(" ) + 10 );
orig = Num( Left( orig, Contains( orig, ")" ) - 1 ) );
width = Substr( jrn, Contains( jrn, "scaleWidth(" ) + 11 );
width = Num( Left( width, Contains( width, ")" ) - 1 ) );
Eval List( {orig, orig + width} );
);
dt = Open("data_table.jmp");
w = New Window( "local filter",
df = dt << Data Filter(
Conditional,
Local,
Add Filter(
columns( :POP, :OZONE, :SO2 ),
Where( :POP >= 3497.5 & :POP <= 8529 ),
Where( :SO2 >= 0.033 & :SO2 <= 0.083 ),
Where( :OZONE >= 0.16 & :OZONE <= 0.21 )
)
)
);
(df << Get Filter Column( :OZONE )) << Where( :OZONE >= 0.17 & :OZONE <= 0.21 );
(df << Get Filter Column( :SO2 )) << Where( :SO2 >= 0.033 & :SO2 <= 0.05 );
Code Explanation:
- Define
frameExtentsfunction. - Open data table.
- Create new window "local filter".
- Add Data Filter to data table.
- Set filter conditions for POP, OZONE, SO2.
- Modify OZONE filter condition.
- Modify SO2 filter condition.
Data Filter using Preferences
Summary: Configures summary graph preferences and data filtering in JMP, allowing for customized visualization and analysis of data.
Code:
Names Default To Here( 1 );
c = 0.9;
Preferences(
Show Summary Graphs Below Column Names( 1 ),
Summary Graph Continuous Color( RGB Color( c, 0, 0 ) ),
Summary Graph Continuous Missing Color( RGB Color( 0, 0, c ) ),
Summary Graph Size Ordered Color( RGB Color( 0, c, 0 ) ),
Summary Graph Name Ordered Color( RGB Color( 0, c, c ) ),
Summary Graph Other Color( RGB Color( c, c, 0 ) )
);
Open("data_table.jmp");
For( i = 1, i < 50, i++,
Row State( i ) = Selected State( 0 )
);
Current Data Table() << Data Filter(
Location( {599, 196} ),
Add Filter( columns( :Year, :Size ), Display( :Year, N Items( 5 ) ), Display( :Size, N Items( 8 ) ) )
);
Code Explanation:
- Set default names scope.
- Define color constant
c. - Set preferences for summary graphs.
- Open data table.
- Loop through first 49 rows.
- Unselect each row.
- Apply data filter to current table.
- Set filter location.
- Add filter for columns "Year" and "Size".
- Display filters with specified settings.
Local Data Filter
Summary: Process of running a fit model script, adding local data filters, and sending reports with pin annotations to visualize the results.
Code:
dt = Open("data_table.jmp");
obj = dt << run script( "fit model" );
obj << Local Data Filter( Add Filter( columns( :RUN # ), Display( :RUN #, "Check Box Display", Find( Set Text( "" ) ) ) ) );
obj << SendToReport(
Dispatch( {"Response MN ckt wx", "Whole Model", "Actual by Predicted Plot"}, "FitLS Leverage", FrameBox,
Add Pin Annotation(
Seg( Marker Seg( 1 ) ),
Index( 7 ),
Index Row( 7 ),
UniqueID( 7 ),
FoundPt( {380, 456} ),
Origin( {1.3066617481203, 1.294024} ),
RightOfCenter( 0 ),
Tag Line( 1 )
)
),
Dispatch( {"Response MN ckt wx", "Whole Model", "Residual by Predicted Plot"}, "FitLS Leverage", FrameBox,
Add Pin Annotation(
Seg( Marker Seg( 1 ) ),
Index( 3 ),
Index Row( 3 ),
UniqueID( 3 ),
FoundPt( {341, 520} ),
Origin( {1.21653381410256, 0.0408873379629631} ),
RightOfCenter( 0 ),
Tag Line( 1 )
)
)
);
obj = dt << run script( "fit model" );
obj << Local Data Filter( Add Filter( columns( :PEB ), Where( :PEB >= 100 & :PEB <= 120 ) ) );
obj << SendToReport(
Dispatch( {"Response MN ckt wx", "Whole Model", "Actual by Predicted Plot"}, "FitLS Leverage", FrameBox,
Add Pin Annotation(
Seg( Marker Seg( 1 ) ),
Index( 7 ),
Index Row( 7 ),
UniqueID( 7 ),
FoundPt( {380, 456} ),
Origin( {1.3066617481203, 1.294024} ),
RightOfCenter( 0 ),
Tag Line( 1 )
)
),
Dispatch( {"Response MN ckt wx", "Whole Model", "Residual by Predicted Plot"}, "FitLS Leverage", FrameBox,
Add Pin Annotation(
Seg( Marker Seg( 1 ) ),
Index( 3 ),
Index Row( 3 ),
UniqueID( 3 ),
FoundPt( {341, 520} ),
Origin( {1.21653381410256, 0.0408873379629631} ),
RightOfCenter( 0 ),
Tag Line( 1 )
)
)
);
Code Explanation:
- Open table.
- Run fit model script.
- Add local data filter.
- Send report with pin annotations.
- Run fit model script again.
- Add local data filter with condition.
- Send report with pin annotations.
Data Filter using Column
Example 1
Summary: Data filtering and selection based on specific criteria, including missing values and nominal population categories.
Code:
dt = Open("data_table.jmp");
Column( "region" )[1] = "";
Column( "region" )[2] = "";
Column( "region" )[3] = "";
Column( "pop" )[1] = .;
Column( "pop" )[2] = .;
Column( "pop" )[3] = .;
Column( "POP" ) << modeling type( "Nominal" );
dt << New Column( "Rank", numeric, ordinal, Formula( Row() ) );
Column( "Rank" ) << Delete Formula;
Column( "rank" )[1] = .;
Column( "rank" )[2] = .;
Column( "rank" )[3] = .;
df = dt << Data Filter(
Location( {360, 74} ),
Add Filter(
columns( :city, :OZONE, :SO2 ),
Where(
:city == {"ALBANY", "ALBUQUERQUE", "ATLANTA", "ATLANTIC CITY", "BALTIMORE", "BOSTON", "BURLINGTON", "CHARLESTON", "CHARLOTTE",
"CHEYENNE", "CHICAGO", "CINCINNATI", "CLEVELAND", "DENVER"}
),
Where( :OZONE >= 0.096 & :OZONE <= 0.33 ),
Where( :SO2 >= 0.001 & :SO2 <= 0.065 ),
Display( :city, Size( 204, 259 ), List Display )
),
Add Filter( columns( :POP ), Where( Is Missing( :POP ) | :POP == 347 ), Display( :POP, Size( 204, 259 ), List Display ) ),
Add Filter( columns( :Rank ), Where( Is Missing( :Rank ) | :Rank == 7 ), Display( :Rank, Size( 204, 259 ), List Display ) )
);
cert = dt << get selected rows;
gwc = df << get where clause;
df << Close;
dt << Clear Select;
Eval( Parse( "dt << " || gwc ) );
gsr = dt << Get Selected Rows;
Code Explanation:
- Open data table.
- Clear first three region entries.
- Set first three population values to missing.
- Change POP column to nominal.
- Create new "Rank" column.
- Remove formula from "Rank" column.
- Set first three rank values to missing.
- Create data filter with specified criteria.
- Get selected rows from data table.
- Get where clause from data filter.
- Close data filter.
- Clear selection in data table.
- Apply where clause to data table.
- Get selected rows from data table.
Example 2
Summary: Data filtering and ranking operations on a JMP data table, utilizing various column and formula manipulation techniques.
Code:
dt = Open("data_table.jmp");
Column( "region" )[1] = "";
Column( "region" )[2] = "";
Column( "region" )[3] = "";
Column( "pop" )[1] = .;
Column( "pop" )[2] = .;
Column( "pop" )[3] = .;
Column( "POP" ) << modeling type( "Nominal" );
dt << New Column( "Rank", numeric, ordinal, Formula( Row() ) );
dt << RunFormulas;
Column( "Rank" ) << Delete Formula;
Column( "rank" )[1] = .;
Column( "rank" )[2] = .;
Column( "rank" )[3] = .;
df = dt << Data Filter(
Location( {360, 74} ),
Add Filter(
columns( :city, :OZONE, :SO2 ),
Where(
:city == {"ALBANY", "ALBUQUERQUE", "ATLANTA", "ATLANTIC CITY", "BALTIMORE", "BOSTON", "BURLINGTON", "CHARLESTON", "CHARLOTTE",
"CHEYENNE", "CHICAGO", "CINCINNATI", "CLEVELAND", "DENVER"}
),
Where( :OZONE >= 0.096 & :OZONE <= 0.33 ),
Where( :SO2 >= 0.001 & :SO2 <= 0.065 ),
Display( :city, Size( 204, 259 ), List Display )
),
Add Filter( columns( :POP ), Where( Is Missing( :POP ) | :POP == 347 ), Display( :POP, Size( 204, 259 ), List Display ) ),
Add Filter( columns( :Rank ), Where( Is Missing( :Rank ) | :Rank == 7 ), Display( :Rank, Size( 204, 259 ), List Display ) )
);
fave = df << Add Favorites( "Selected Rows" );
df << Clear;
df << Apply Favorites( "Selected Rows" );
df << Delete All;
df << Apply Favorites( "Selected Rows" );
df << Save script to data table;
df << Remove Favorites( "Selected Rows" );
skript = dt << Get Property( "Data Filter" );
Code Explanation:
- Open data table.
- Clear first three region values.
- Set first three population values to missing.
- Change POP column type to nominal.
- Create new "Rank" column with row numbers.
- Run formulas in data table.
- Delete formula from "Rank" column.
- Set first three rank values to missing.
- Create data filter with specified conditions.
- Add favorites for selected rows.
- Clear data filter.
- Apply favorites to data filter.
- Delete all rows in data filter.
- Apply favorites again.
- Save script to data table.
- Remove favorites from data filter.
- Retrieve data filter script.
Example 3
Summary: Filters and manipulates data in a JMP table, setting city values to empty, creating a data filter with specific criteria, and applying favorites.
Code:
dt = Open("data_table.jmp");
Column( dt, "city" )[9] = "";
Column( dt, "city" )[10] = "";
Column( dt, "city" )[11] = "";
Column( dt, "city" )[12] = "";
df = dt << Data Filter(
Location( {1107, 173} ),
Add Filter(
columns( :city, :OZONE ),
Where(
:city == {"", "ALBUQUERQUE", "ATLANTIC CITY", "BOSTON", "CHARLESTON", "DENVER", "DETROIT", "GALVESTON-T.C.", "HARTFORD",
"HUNTINGTON", "JACKSON", "LOS ANGELES", "MADISON", "MILWAUKEE", "MOBILE", "NASHVILLE", "NEW YORK", "OKLAHOMA CITY",
"PHILADELPHIA", "PORTLAND", "SALT LAKE CITY", "SEATTLE", "ST. LOUIS", "WICHITA"}
),
Where( :OZONE >= 0.095 & :OZONE <= 0.281 ),
Display( :city, Size( 204, 174 ), List Display )
)
);
df << Inverse( 1 );
wc2 = df << Add Favorites( "Inverse Original" );
df << Clear;
df << Apply Favorites( "Inverse Original" );
filterRows = df << Get Filtered Rows;
df << (filter column( :OZONE ) << Invert Selection);
df << (filter column( :city ) << Invert Selection);
Code Explanation:
- Open table.
- Set city values to empty.
- Create data filter.
- Add filter criteria.
- Set filter location.
- Invert filter.
- Add favorite filter.
- Clear current filter.
- Apply favorite filter.
- Get filtered rows.
Data Filter using Run script
Summary: Creates a treemap visualization using Graph Builder, filtering data based on specific conditions and deleting unnecessary columns.
Code:
dt = Open("data_table.jmp");
tm = dt << Run script( "Graph Builder Treemap" );
ldf = tm << Local Data Filter(
Location( {673, 257} ),
Conditional,
Mode( Select( 0 ), Show( 1 ), Include( 1 ) ),
Add Filter(
columns( :city, :State, :Region, :OZONE ),
Display( :city, Size( 204, 174 ), List Display ),
Display( :State, Size( 204, 174 ), List Display ),
Display( :OZONE )
)
);
ldf << (Filter Column( :region ) << Where( :region == "N" ));
ldf << (Filter Column( :state ) << Where( :age == {"NY", "PA"} ));
ldf << (Filter Column( :city ) << Where( :city == {"ALBANY", "HARRISBURG"} ));
ldf << (Filter Column( :OZONE ) << Where( :OZONE > 0.131 ));
ldf << Delete( {:city} );
rep4 = ldf << report;
Code Explanation:
- Open data table;
- Run Graph Builder Treemap script.
- Create local data filter.
- Set filter location and mode.
- Add filter for specified columns.
- Filter region where region is "N".
- Filter state where state is "NY" or "PA".
- Filter city where city is "ALBANY" or "HARRISBURG".
- Filter OZONE where OZONE is greater than 0.131.
- Delete city column from filter.
Data Filter using Run Script
Example 1
Summary: Creates and applies a local data filter to select specific values in the 'Floss Delimited' column, utilizing interactive features like check boxes and favorites.
Code:
dt = Open("data_table.jmp");
cat = dt << Run Script( "Categorical Several" );
ldf = cat << Local Data Filter(
Mode( Select( 0 ), Show( 1 ), Include( 1 ) ),
Add Filter(
columns( :Floss Delimited, :Floss Delimited ),
Match Any( Where( :Floss Delimited == "After Meal" ) ),
Match Any( Where( :Floss Delimited == "Before Sleep" ) ),
Display( :Floss Delimited, Size( 121, 87 ), Check Box Display ),
Display( :Floss Delimited, Size( 121, 87 ), Check Box Display )
)
);
ldf << Add Favorites( "Two of the Same" );
ldf << Delete All;
ldf << Apply Favorites( "Two of the Same" );
where1 = Words( ldf << Get Where clause, "\!r\!n\!N" );
Code Explanation:
- Open data table;
- Run "Categorical Several" script.
- Create local data filter.
- Set filter mode to select, show, include.
- Add filter for "Floss Delimited".
- Match "After Meal" and "Before Sleep".
- Display filter with check boxes.
- Add favorites named "Two of the Same".
- Delete all filters.
- Apply favorites "Two of the Same".
Example 2
Summary: Data filtering and reporting for a JMP data table, setting sex value labels and age value labels, and retrieving filtered results based on host OS.
Code:
dt = Open("data_table.jmp");
dt << Run Script( "Set Sex Value Labels" );
dt << Run Script( "Set Age Value Labels" );
df = dt << Data Filter(
Location( {310, 310} ),
Add Filter(
columns( :age, :sex ),
Where( :sex == "F" ),
Where( :age == 15 ),
Display( :age, Size( 204, 72 ), List Display ),
Display( :sex, Check Box Display )
)
);
If( Host is( windows ),
ageList = Window( "Data Filter for data_table" )[listboxbox( 1 )] << get items,
dfrep = df << Report;
ageList = dfrep[listboxbox( 1 )] << get items;
);
If( Host is( windows ),
genderList = Window( "Data Filter for data_table" )[Number Col Box( 1 )] << get text,
dfrep = df << Report;
genderList = dfrep[Number Col Box( 1 )] << get text;
);
Code Explanation:
- Open data table.
- Run script to set sex labels.
- Run script to set age labels.
- Create data filter.
- Set filter location.
- Add filter for age and sex.
- Apply filter conditions.
- Display age in list box.
- Display sex in check box.
- Retrieve age list based on host OS.
- Retrieve gender list based on host OS.
Example 3
Summary: Runs a contingency analysis on a filtered data table, generating a report with specified settings.
Code:
dt = Open("data_table.jmp");
obj = dt << Run Script( "Contingency" );
obj << Local Data Filter(
Location( {0, 0} ),
Add Filter( columns( :sex ), Where( :sex == "F" ) ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
);
obj << Automatic Recalc( 0 );
dt << Select Where( :age == 12 );
dt << Exclude();
rpt = obj << Report;
Code Explanation:
- Open data table.
- Run contingency analysis.
- Add local data filter.
- Set filter location.
- Filter by sex female.
- Configure filter mode.
- Disable automatic recalculation.
- Select rows where age is 12.
- Exclude selected rows.
- Generate report.
Example 4
Summary: Generates a contingency report by filtering data for female sex and age 12, then excludes selected rows and generates a report.
Code:
dt = Open("data_table.jmp");
obj = dt << Run Script( "Contingency" );
obj << Local Data Filter(
Location( {0, 0} ),
Add Filter( columns( :sex ), Where( :sex == "F" ) ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
);
dt << Select Where( :age == 12 );
dt << Exclude();
rpt = obj << Report;
Close( dt, NoSave );
dt = Open("data_table.jmp");
obj = dt << Run Script( "Contingency" );
obj << Local Data Filter(
Location( {0, 0} ),
Add Filter( columns( :sex ), Where( :sex == "F" ) ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
);
obj << Automatic Recalc( 0 );
dt << Select Where( :age == 12 );
dt << Exclude();
rpt = obj << Report;
Code Explanation:
- Open data table;
- Run Contingency script.
- Add local data filter.
- Filter for female sex.
- Select age 12 rows.
- Exclude selected rows.
- Generate report.
- Close dataset without saving.
- Reopen data_table dataset
- Run Contingency script again.
Example 5
Summary: Data filtering and visualization by running a script, creating local data filters, and customizing display settings for specific variables.
Code:
dt2 = Open("data_table.jmp");
Cate = dt2 << Run Script( "Brushing Delimited by Age" );
ldf1 = Cate << Local Data Filter(
Show Histograms and Bars( 0 ),
Add Filter( columns( :Age Group ), Where( :Age Group == {1, 2} ), Display( :Age Group, Size( 160, 119 ) ) )
);
Cate << Close window;
Preferences( Data filter histograms and bars( 1 ) );
Cate2 = dt2 << Run Script( "Brushing Delimited by Age" );
ldf2 = Cate2 << Local Data Filter(
Add Filter( columns( :Employee Tenure ), Where( :Employee Tenure == 1 ), Display( :Employee Tenure, Size( 160, 68 ) ) )
);
Code Explanation:
- Open data table;
- Run "Brushing Delimited by Age" script.
- Create local data filter.
- Hide histograms and bars.
- Filter by Age Group 1 and 2.
- Set display size for Age Group.
- Close the window.
- Enable data filter histograms and bars.
- Run "Brushing Delimited by Age" script again.
- Create local data filter for Employee Tenure.
Data Filter using If
Example 1
Summary: Data filtering and window sizing on a JMP dataset, utilizing the Data Filter feature to create a filtered view of the data.
Code:
If( Host is( windows ),
dt = Open("data_table.jmp");
df = dt << Data Filter( Add Filter( columns( :age, :sex ) ), show window( 0 ) );
ws = Window( "Data Filter for data_table" ) << get window size();
df << Show Window( 1 );
{x, y} = Window( "Data Filter for data_table" ) << get window size();
If( x > 200 & y > 200,
ws = 1,
ws = 0
);
Close( dt, no save );
);
Code Explanation:
- Check if host is Windows.
- Open data table;
- Create data filter on age and sex.
- Hide data filter window.
- Get initial window size.
- Show data filter window.
- Get updated window size.
- Compare window sizes.
- Set ws variable based on comparison.
- Close dataset without saving.
Example 2
Summary: Data filtering and selection for a JMP data table, utilizing the Data Filter feature to filter by age and sex, and updating a checkbox box accordingly.
Code:
If( Host is( windows ),
dt = Open("data_table.jmp");
df = dt << Data Filter( Add Filter( columns( :age, :sex ) ) );
df << set select( 0 );
selectBox = Window( "Data Filter for data_table" )[checkboxbox( 1 )] << Get( 1 );
df << set select( 1 );
selectBox = Window( "Data Filter for data_table" )[checkboxbox( 1 )] << Get( 1 );
Close( dt, no save );
);
Code Explanation:
- Check if host is Windows.
- Open data table.
- Add data filter for age and sex.
- Deselect all filters initially.
- Get reference to checkbox box.
- Select all filters.
- Update checkbox box status.
- Deselect all filters again.
- Update checkbox box status.
- Close data table without saving.
Example 3
Summary: Data filtering and checkbox object manipulation for a JMP dataset, utilizing the Data Filter feature to filter by age and sex.
Code:
If( Host is( windows ),
dt = Open("data_table.jmp");
df = dt << Data Filter( Add Filter( columns( :age, :sex ) ) );
df << set show( 1 );
selectBox = Window( "Data Filter for data_table" )[checkboxbox( 2 )] << Get( 1 );
df << set show( 0 );
selectBox = Window( "Data Filter for data_table" )[checkboxbox( 2 )] << Get( 1 );
Close( dt, no save );
);
Code Explanation:
- Check if host is Windows.
- Open data table;
- Create data filter for age and sex.
- Show data filter window.
- Get checkbox box object.
- Hide data filter window.
- Get checkbox box object again.
- Close dataset without saving.
Example 4
Summary: Data filtering and selection for a JMP data table on Windows, utilizing the Data Filter feature to interactively manage rows.
Code:
If( Host is( windows ),
dt = Open("data_table.jmp");
df = dt << Data Filter( Add Filter( columns( :age, :sex ) ) );
df << set include( 1 );
selectBox = Window( "Data Filter for data_table" )[checkboxbox( 3 )] << Get( 1 );
df << set include( 0 );
selectBox = Window( "Data Filter for data_table" )[checkboxbox( 3 )] << Get( 1 );
Close( dt, no save );
);
Code Explanation:
- Check if host is Windows.
- Open data table.
- Add data filter for age and sex.
- Set filter to include all rows.
- Get selected items from checkbox box.
- Set filter to exclude all rows.
- Get selected items from checkbox box again.
- Close data table without saving.
Data Filter using Select Where
Summary: Filters and displays data for specific conditions in a JMP data table, utilizing Data Filter and Hide and Exclude operations.
Code:
dt = Open("data_table.jmp");
dt << Select Where( :Gender == 1 );
dt << Hide and Exclude;
df = dt << Data Filter(
Location( {538, 43} ),
Save and restore current row states( 1 ),
Add Filter(
columns( :Brush Delimited, :Floss Delimited ),
Match Any( Where( :Brush Delimited == "Before Sleep" ) ),
Match Any( Where( :Floss Delimited == "Before Sleep" ) ),
Display( :Brush Delimited, Size( 121, 70 ), Check Box Display ),
Display( :Floss Delimited, Size( 121, 87 ), Check Box Display )
),
Mode( Show( 1 ), Include( 1 ) )
);
df << Close;
Code Explanation:
- Open data table;
- Select rows where Gender == 1.
- Hide and exclude selected rows.
- Create data filter.
- Set filter location.
- Save and restore row states.
- Add filter for Brush Delimited.
- Add filter for Floss Delimited.
- Set display for Brush Delimited.
- Set display for Floss Delimited.
Data Filter using Chart
Example 1
Summary: Creates a bar chart to visualize mean age distribution by sex, with interactive filtering and formatting options.
Code:
Open("data_table.jmp");
obj = Chart(
X( :sex ),
Y( Mean( :age ) ),
Overlay Axis << {{Format( "Fixed Dec", 12, 0 ), Min( 0 ), Max( 55 ), Inc( 10 ), Minor Ticks( 1 )}},
Overlay Stack Axis << {{Format( "Fixed Dec", 12, 0 ), Min( 0 ), Max( 120 ), Inc( 20 ), Minor Ticks( 1 )}},
Bar Chart( 1 ),
Local Data Filter( Add Filter( columns( :age ), Where( :age >= 40.6 & :age <= 60 ) ) )
);
rpt = obj << Report;
expr = rpt << Get Journal;
p = ":age >= 40.6";
ans = Pat Match( expr, p );
Code Explanation:
- Open data table.
- Create chart object.
- Set X-axis to sex.
- Set Y-axis to mean age.
- Format overlay axis.
- Format overlay stack axis.
- Add bar chart.
- Apply local data filter.
- Generate report.
- Extract journal expression.
- Define pattern.
- Find pattern match.
Example 2
Summary: Creates a bar chart to visualize age distribution by sex, with interactive filtering and formatting options.
Code:
dt = Open("data_table.jmp");
obj = Chart(
X( :sex ),
Y( Mean( :age ) ),
Overlay Axis << {{Format( "Fixed Dec", 12, 0 ), Min( 0 ), Max( 55 ), Inc( 10 ), Minor Ticks( 1 )}},
Overlay Stack Axis << {{Format( "Fixed Dec", 12, 0 ), Min( 0 ), Max( 120 ), Inc( 20 ), Minor Ticks( 1 )}},
Bar Chart( 1 ),
Local Data Filter( Add Filter( columns( :age ), Where( :age >= 40.6 & :age <= 60 ) ) )
);
rpt = obj << Report;
expr = rpt << Get Journal;
p = ":age >= 40.6";
ans = Pat Match( expr, p );
Code Explanation:
- Open table.
- Create chart object.
- Set X-axis variable.
- Set Y-axis variable.
- Format overlay axis.
- Format overlay stack axis.
- Add bar chart.
- Apply local data filter.
- Generate report.
- Extract journal expression.
Data Filter using Tree Map
Example 1
Summary: Creates a tree map report from a data table, filtering by country and type, and excluding selected rows.
Code:
dt = Open("data_table.jmp");
obj = Tree Map(
Categories( :country, :marital status ),
Coloring( :country ),
Local Data Filter( Add Filter( columns( :country ), Where( :country == "American" ) ), Mode( Select( 0 ), Show( 1 ), Include( 1 ) ) ),
);
obj << Automatic Recalc( 0 );
dt << Select Where( :type == "Family" );
dt << Exclude();
rpt = Report( obj );
Code Explanation:
- Open data table.
- Create tree map object.
- Set categories and coloring.
- Add local data filter.
- Configure filter mode.
- Disable automatic recalculation.
- Select rows by type.
- Exclude selected rows.
- Generate report from tree map.
Example 2
Summary: Creates and customizes a Tree Map object to visualize data, applying filters and recalculation settings, and generates reports from the filtered data.
Code:
dt = Open("data_table.jmp");
obj = Tree Map(
Categories( :country, :marital status ),
Coloring( :country ),
Local Data Filter( Add Filter( columns( :country ), Where( :country == "American" ) ), Mode( Select( 0 ), Show( 1 ), Include( 1 ) ) ),
);
obj << Automatic Recalc( 1 );
dt << Select Where( :type == "Family" );
dt << Exclude();
rpt = Report( obj );
Close( dt, NoSave );
dt = Open("data_table.jmp");
obj = Tree Map(
Categories( :country, :marital status ),
Coloring( :country ),
Local Data Filter( Add Filter( columns( :country ), Where( :country == "American" ) ), Mode( Select( 0 ), Show( 1 ), Include( 1 ) ) ),
);
obj << Automatic Recalc( 0 );
dt << Select Where( :type == "Family" );
dt << Exclude();
rpt = Report( obj );
Code Explanation:
- Open data_table data
- Create Tree Map object.
- Set categories and coloring.
- Add local data filter for country.
- Enable automatic recalculation.
- Select rows where type is Family.
- Exclude selected rows.
- Generate report from Tree Map.
- Close data table without saving.
- Reopen data_table data.
- Create Tree Map object again.
- Set categories and coloring.
- Add local data filter for country.
- Disable automatic recalculation.
- Select rows where type is Family.
- Exclude selected rows.
- Generate report from Tree Map.
Data Filter using Auto Clear
Summary: Data filtering and selection for a specific dataset, utilizing various filter conditions to narrow down the data based on age, sex, and height.
Code:
dt = Open("data_table.jmp");
obj = (Current Data Table() << data filter( show window( 0 ) ));
obj << Auto Clear( 1 );
obj << add filter( columns( :age, :sex, :height ) );
obj << (filter column( :age ) << Where( :age = {12, 13} ));
obj << (filter column( :age ) << invert selection);
obj << (filter column( :sex ) << Where( :sex = {"M"} ));
obj << (filter column( :height ) << Where( (:height < 58) | (:height > 65) ));
obj << Auto Clear( 0 );
Code Explanation:
- Open data table;
- Create data filter object.
- Disable auto clear.
- Add filter for age, sex, height.
- Filter age 12 and 13.
- Invert age selection.
- Filter sex male.
- Filter height less than 58 or greater than 65.
- Enable auto clear.
Data Filter using Where
Summary: Data filtering and column selection for a specific dataset, targeting males with age 12.
Code:
dt = Open("data_table.jmp");
obj = (dt << data filter());
obj << add filter columns( :sex, :age );
obj << (filter column( :sex ) << Where( :sex == "M" ));
obj << autoclear( 0 );
obj << (filter column( :age ) << Where( :age == 12 ));
Code Explanation:
- Open data table.
- Create data filter object.
- Add filter columns: sex, age.
- Filter sex for males.
- Disable auto-clear filter.
- Filter age for 12 years old.