cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar

Saving a filter definition as a new column

Let's propose that I need to create a new group of consumers from my dataset and to be in this group they have to meet specific criteria from more than 1 column/variable (i.e., females [from the gender column] who also have a low income [income column] ).   I want to be able to then save this as a new column/variable and be able to use this new column in various tables going forward (for instance at the top of a table in JMP Categorical, to be able to compare it to another column/variable (i.e., males who have a low income).  Hoping JMP has an option to do this fairly simply that doesn't require sophisticated re-coding, etc., which most of our users will not want to have to do.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Saving a filter definition as a new column

I assume it is because the column has not been defined as character.

Jim

View solution in original post

7 REPLIES 7
txnelson
Super User

Re: Saving a filter definition as a new column

The very easy way is to select the columns that you want the new variable to be based upon(Gender, Income) and then go to the pulldown menu, Col==>Utility==>Combine Columns.

10788_pastedImage_0.png

Fill in the new column name and the delimiter and you will get your new column

Jim

Re: Saving a filter definition as a new column

Thank you for your quick reply Jim.  that seemed to work for combining 2 variables (thanks for that, I didn't know I could do that).  But that doesn't allow me to apply logic that I need (an "and" or an "or" logic) between the 2 column/variables.  I don't want all the elements of each column, just specific criteria from both with some type of and/or logic, to in turn, save this as a new column/variable.

So combining the 2 columns gave me all the elements from both columns at the top of my table.  But it doesn't allow me to find the criteria of:  only females who are low income, then save the variable in my list, Then find the criteria of:  males who are only low income, then save that variable in my list.

txnelson
Super User

Re: Saving a filter definition as a new column

JMP will paste into all selected cells for a selected column whatever value is in the clipboard.  Therefore, if you create a new column and then copy into your clipboard "Group A" and you then rt. mouse click on the top of the Rowstate column in JMP and select Row Selection, you can use a variety of different tools to select the rows you want to have the "Group A" , then just go to the selected area of the new column, for one of the selected rows, and paste into that cell, the paste will happen for all selected rows.

If you want to get a little more fancy, a feature of JMP Scripting Language(JSL) is that you can assign a value to all selected rows for a given column.  The statement that has the same functionality as my above example is:

    newcolumnname[data table("the table name")<<get selected rows] = "Group A";

So it would be a very simple matter to develop a JMP Addin that when run would ask the user for what column to target, and what value to place in that column and then when OK is selected, the input value would be placed into all selected rows for the column specified.

Jim
Jeff_Perkinson
Community Manager Community Manager

Re: Saving a filter definition as a new column

Try using the Data Filter to select the rows that meet your criteria and then use Rows > Row Selection > Name Selection in Column​ to create a new column with the name of the selected (and unselected rows).


-Jeff
txnelson
Super User

Re: Saving a filter definition as a new column

I liked the suggestion that Jeff made, about using a data filter to do the selections.  So, I put together a simple addin that lets the user use a Data Filter to do the selection, and then specify the Value to be written and the column it is to be written to.

10807_pastedImage_0.png

One selects the column to change and then uses the data filter to select the rows to be changed.  Then one places the value to be used to identify this grouping, and then click on the Set Value button.

10808_pastedImage_1.png

and the values are then set for the selected rows in the data table

10809_pastedImage_2.png

I have attached the JMP addin

Jim

Re: Saving a filter definition as a new column

Thank you for this add-in!  Very helpful.  Question on it:  What could be the reason that my newly created column doesn't show up when I choose the "select column to change" button.  I noticed the list of columns it brings back doesn't include some other columns in my dataset that I know exist, as well.  I made sure to change my column to "nominal", but that didn't help.  Thoughts?

txnelson
Super User

Re: Saving a filter definition as a new column

I assume it is because the column has not been defined as character.

Jim