Where
Example 1
Summary: Selects rows in a data table where the type is 'interior'.
Code:
dt = Open("data_table.jmp");
dt << select where( :type of space == "interior" );
Code Explanation:
- Open data table.
- Select rows where type is interior.
Example 2
Summary: Selects female records from a data table, utilizing the WHERE clause to filter rows based on sex.
Code:
dt = Open("data_table.jmp");
dt << select where( :sex == "F" );
Code Explanation:
- Open data table;
- Select rows where sex is female.
Example 3
Summary: Selects data by opening a data table, selecting rows where Calories equals 190.
Code:
dt = Open("data_table.jmp");
dt << select where( :Calories == 190 );
Code Explanation:
- Open data table;
- Select rows where Calories equals 190.
Example 4
Summary: Selects and excludes rows in a data table based on specific conditions, utilizing the WHERE clause to identify matching records.
Code:
dt = Open("data_table.jmp");
myrows = dt << get rows where( :age == 12 );
dt << select rows( myrows );
dt << exclude( 1 );
dt << hide( 1 );
Code Explanation:
- Open data table.
- Identify rows where age is 12.
- Select identified rows.
- Exclude selected rows.
- Hide excluded rows.
Example 5
Summary: Selects and hides rows in a data table based on specific conditions, utilizing the WHERE clause to restrict the selection.
Code:
dt = Open("data_table.jmp");
dt << select where( :age == 14, current selection( "Restrict" ) );
dt << hide;
dt << clear select;
Code Explanation:
- Open data table;
- Select rows where age is 14.
- Restrict selection to current selection.
- Hide selected rows.
- Clear selection.
Example 6
Summary: Selects and hides rows in a data table based on specific conditions, utilizing the WHERE clause.
Code:
dt = Open("data_table.jmp");
dt << select where( :age == 14 & :sex == "F" );
dt << hide;
dt << clear select;
Code Explanation:
- Open data table.
- Select rows where age is 14.
- Select rows where sex is female.
- Hide selected rows.
- Clear selection.
Example 7
Summary: Excludes rows with specific smoking history values from a data table, utilizing the WHERE clause and EXCLUDE operation.
Code:
dt = Open("data_table.jmp");
myExcludedRows = dt << get rows where( :Smoking History == "pipes" | :SmokingHistory == "cigarettes" );
dt << select rows( myExcludedRows );
dt << exclude;
Code Explanation:
- Open data table.
- Identify smoking history rows.
- Select identified rows.
- Exclude selected rows.
Example 8
Summary: Selects rows from a data table where age equals 14, utilizing the WHERE clause.
Code:
dt = Open("data_table.jmp");
dt << select where( :age == 14 );
Code Explanation:
- Open data table;
- Select rows where age equals 14.
Example 9
Summary: Selects and excludes rows in a data table based on specific conditions, utilizing the Where() function to filter out unwanted records.
Code:
dt = Open("data_table.jmp");
myRows = dt << get rows where( :age == 14 & :sex == "F" );
dt << select rows( myRows );
dt << exclude;
Code Explanation:
- Open data table.
- Assign rows where age is 14 and sex is female.
- Select assigned rows.
- Exclude selected rows.
Example 10
Summary: Selects rows in a data table where smoking history is 'cigarettes', utilizing the WHERE clause.
Code:
dt = Open("data_table.jmp");
dt << select where( :Smoking History == "cigarettes" );
Code Explanation:
- Open data table.
- Select rows where smoking history is cigarettes.
Example 11
Summary: Selects and filters data rows based on specific conditions, opening a JMP data table and selecting rows where age is 14 and sex is 'F'.
Code:
dt = Open("data_table.jmp");
dt << select where( :age == 14 & :sex == "F" );
Code Explanation:
- Open data table;
- Select rows where age is 14.
- Filter selected rows for female sex.
Example 12
Summary: Selects and excludes data rows based on specific conditions, opening a JMP data table and filtering by age and sex.
Code:
dt = Open("data_table.jmp");
dt << select where( :age == 12 & :sex == "F" );
dt << exclude;
Code Explanation:
- Open data table.
- Select rows where age is 12.
- Select rows where sex is female.
- Exclude selected rows.
Example 13
Summary: Selects and filters data rows based on specific conditions, opening a JMP data table and selecting male individuals aged 16.
Code:
dt = Open("data_table.jmp");
dt << select where( :sex == "M" & :age == 16 );
Code Explanation:
- Open data table;
- Select rows where sex is Male.
- Filter selected rows where age is 16.
Example 14
Summary: Selects and filters data rows based on sex and height, opening a JMP data table.
Code:
dt = Open("data_table.jmp");
dt << select where( :sex == "M" & 58 <= :height < 60 );
Code Explanation:
- Open data table.
- Select rows where sex is male.
- Filter height between 58 and 60 inches.
Example 15
Summary: Selects rows in a data table where the name is 'LAWRENCE'.
Code:
dt = Open("data_table.jmp");
dt << select where( :name == "LAWRENCE" );
Code Explanation:
- Open data table.
- Select rows where name is Lawrence.
Example 16
Summary: Selects and labels specific rows in a data table, utilizing the WHERE clause to filter by age and name.
Code:
dt = Open("data_table.jmp");
dt << clear row states;
rs = dt << select where( :age == 12 );
rs << hide and exclude;
rs = dt << select where( :name == "LESLIE" );
dt << label();
Code Explanation:
- Open data table.
- Clear row states.
- Select age 12 rows.
- Hide and exclude selected rows.
- Select name "LESLIE".
- Label selected rows.
Example 17
Summary: Selects and hides rows in a data table based on specific conditions, utilizing the WHERE clause to filter out unwanted data.
Code:
dt = Open("data_table.jmp");
dt << select where( :age == 12 );
dt << hide;
Code Explanation:
- Open data table.
- Select rows where age is 12.
- Hide selected rows.
Example 18
Summary: Selects rows from a data table where age is 17, utilizing the WHERE clause.
Code:
dt = Open("data_table.jmp");
dt << select where( :age == 17 );
Code Explanation:
- Open data table.
- Select rows where age is 17.
Example 19
Summary: Process of updating names in a data table by concatenating special characters, specifically targeting rows where the name is 'KATIE'.
Code:
dt = Open("data_table.jmp");
rs = dt << get rows where( :name == "KATIE" );
:name[rs] = "KATIE" || "\";
Code Explanation:
- Open data table.
- Assign table reference to
dt. - Get rows where name is "KATIE".
- Assign row indices to
rs. - Concatenate special character to names.
- Update name column with new values.
Select Where
Example 1
Summary: Selects rows in a data table based on specific country codes, utilizing the Select Where platform.
Code:
dt = Open("data_table.jmp");
dt << Select Where( :Country == 1125 | :Country == 4120 );
Code Explanation:
- Open data table;
- Select rows where Country is 1125 or 4120.
Example 2
Summary: Selects male data points from a data table, utilizing the Select Where platform in JMP.
Code:
dt = Open("data_table.jmp");
dt << Select Where( :sex == "M" );
Code Explanation:
- Open data table.
- Select rows where sex is male.
Example 3
Summary: Filtering and selection process for a data table, excluding records with specific values and clearing any previous selections.
Code:
dt = Open("data_table.jmp");
dt << Select Where( :sex == "F" & :height != 61 );
dt << Exclude;
dt << Clear Select;
Code Explanation:
- Open data table.
- Select female records.
- Exclude height 61 records.
- Clear selection.
Example 4
Summary: Selects and hides data table rows based on age criteria, utilizing JMP's built-in filtering capabilities.
Code:
dt = Open("data_table.jmp");
dt << Select Where( :age > 50 );
dt << Hide;
Code Explanation:
- Open data table.
- Select rows where age > 50.
- Hide selected rows.
Example 5
Summary: Selects and filters rows in a data table based on specific conditions, including age, sex, and weight.
Code:
dt = Open("data_table.jmp");
obj = dt << get row states;
obj = dt << Select Where( :age == 17 & :sex == "M" & :weight == 64 );
df = obj << get row states;
Code Explanation:
- Open data table;
- Get row states.
- Select rows where age is 17.
- Select rows where sex is "M".
- Select rows where weight is 64.
- Get row states again.
Example 6
Summary: Data filtering and extraction by opening a data table, selecting rows based on a specific player, creating a data view, and extracting all columns as a matrix.
Code:
dt = Open("data_table.jmp");
dt << Select Where( :Player == "Rick Robey" );
dt2 = dt << data view();
m = dt2 << Get All Columns As Matrix;
Code Explanation:
- Open data table;
- Select rows where Player is Rick Robey.
- Create data view of selected rows.
- Extract all columns as matrix.
Example 7
Summary: Selects and hides rows in a JMP data table based on specific age conditions, utilizing various data manipulation techniques.
Code:
dt = Open("data_table.jmp");
dt << Select Where( :age == 12 );
dt << Hide;
dt << Hide and Exclude;
rs = dt << get row states;
dt << clear row states;
dt << Select Where( :age == 12 );
dt << Exclude;
dt << Select Where( :age == 12 | :age == 13 );
dt << Hide and Exclude;
rs = dt << Get Row States;
Code Explanation:
- Open data_table data
- Select rows where age is 12.
- Hide selected rows.
- Hide and exclude selected rows.
- Get row states.
- Clear row states.
- Select rows where age is 12.
- Exclude selected rows.
- Select rows where age is 12 or 13.
- Hide and exclude selected rows.
Example 8
Summary: Selects and groups data rows based on specific conditions, retrieving names from selected rows.
Code:
dt_limit = Open("data_table.jmp");
dt_limit << Select Where( :age == 12 );
Group1List = (dt_limit:name[dt_limit << get selected rows]);
Code Explanation:
- Open data table;
- Select rows where age is 12.
- Retrieve names from selected rows.
Where using Add Filter
Example 1
Summary: Data filtering by opening a table, adding a filter condition based on the 'Region' column, and clearing the filter.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
df = dt << Data Filter;
df << Add Filter( Columns( :Region ), Where( :Region == "N" ) );
df << Clear;
Code Explanation:
- Open table.
- Access data filter.
- Add filter condition.
- Clear filter.
Example 2
Summary: Runs the filtering process to extract data from a specific region, 'N', by opening a data table, accessing the data filter, adding a region filter, and clearing the data filter.
Code:
dt = Open("data_table.jmp");
df = dt << Data Filter;
df << Add Filter( Columns( :Region ), Where( :Region == "N" ) );
df << Clear;
Code Explanation:
- Open data table.
- Access data filter.
- Add region filter.
- Set region to "N".
- Clear data filter.
Get Rows Where
Summary: Runs data table operations by opening a file, retrieving all rows, and defining an age list.
Code:
dt = Open("data_table.jmp");
dt << Get Rows Where();
certage =
"[12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 17, 17, 17]";
a = :age << GetAsMatrix;
Code Explanation:
- Open data table;
- Retrieve all rows from table.
- Define ages list.
- Assign age column to variable a.
Select where
Example 1
Summary: Selects and hides rows in a data table, based on specific conditions.
Code:
dt = Open("data_table.jmp");
dt << Select where( :age == 13 );
dt << Hide;
dt << Hide( 1 );
dt << Hide;
dt << Hide;
dt << Hide( 0 );
Code Explanation:
- Open data table;
- Select rows where age is 13.
- Hide selected rows.
- Hide first column.
- Hide selected rows again.
- Hide selected rows again.
- Hide all columns.
- Unhide first column.
Example 2
Summary: Runs data table operations to select rows based on age, apply labels, and manage label colors.
Code:
dt = Open("data_table.jmp");
dt << Select where( :age == 13 );
dt << Label;
dt << Label( 1 );
dt << Label;
dt << Label;
dt << Label( 0 );
Code Explanation:
- Open data table.
- Select rows where age is 13.
- Apply label to selected rows.
- Set label color to red.
- Apply label again.
- Set label color to default.
- Apply label again.
- Remove label from selected rows.
Example 3
Summary: Data filtering and labeling operations on a JMP data table, selecting rows where age is 13 and hiding labels for those rows.
Code:
dt = Open("data_table.jmp");
dt << Select where( :age == 13 );
dt << Label << Hide( 1 ) << Exclude( 0 );
dt << Label( 1 ) << Hide << Exclude;
dt << Label << Hide( 0 ) << Exclude( 0 );
dt << Label << Hide << Exclude;
dt << Label( 0 ) << Hide( 0 ) << Exclude( 0 );
Code Explanation:
- Open data table.
- Select rows where age is 13.
- Hide label for selected rows.
- Exclude selected rows.
- Hide label for all rows.
- Exclude all rows.
- Hide label for all rows.
- Exclude all rows.
- Hide label for no rows.
- Exclude no rows.