This Add-in will copy the script of the selected column(s) to the system clipboard. When pasted into a script window and run, the copied script will recreate the original column(s), including all properties (formula, value ordering, etc). This can be useful to move formula columns from one table to another (assuming the necessary columns are available for the formula to operate on).
Nice add-in, @julian.
Can you contrast it with the script you get if you right click on a column header and choose Copy Column Properties?
Great question, Jeff! Both are similar and it's worth distinguishing their uses.
"Copy Column Properties" is useful when you have a new column (or set of columns in the case of "Copy Multi Columns Properties") to which you want to apply the properties available in your source columns (note that format, modeling type, and data types are not included).
Take the example of a column that is standardizing the heights in "Big Class." When you Copy Column Properties, the script in the system clipboard will look like this
Add Column Properties( Formula( Col Standardize( :height ) ) )
An important feature of this method is that the function "Add Column Properties()" encapsulates the available properties of that column, which means when you right click a new column and "Paste Column Properties" those customizations will be applied.
The Add-in here does something subtly different. When copying the script from the same column using the Add-in, the following JSL is placed in the clipboard:
New Column("Standardize[height]", Numeric, "Continuous", Format("Best", 12), Formula(Col Standardize(:height)), Set Selected);
This code includes the JSL for creating a new column of the same name, data type, modeling type, formatting, and all available properties. When run, this creates the identical column, which is useful when porting a large number of formula columns to a new table, especially when there is extensive customization, or for creating a repository of often used columns that one will apply to future tables.
I hope this helps distinguish these two operations!
@julian - I love this add-in! I wanted to emphasize something that you mentioned but didn't really stress about what you've done. Your add-in gets the column properties, yes, but also gets the data type, modeling type, formatting, etc... which are not captured by the "Copy Column Properties". That in and of itself is incredibly useful.
Best,
M
you saved a lot of time for me, Thanks...
Hi,
This is great.
i would like to use this but instead of creating a new column i would like to change properties of an existing column.
for example a for the column called 'Gender' i would like to get these properties:
New Column("Gender", Numeric, "Nominal", Format("Best", 15), Value Labels({0 = "Male", 1 = "Female"}));
Would appreciate tips on what to write instead of 'New Column'...
TIA, Eli
Hi @eliyahu100,
To apply properties from one column to another column you can use the built-in functionality of "Copy Column Properties" and "Paste Column Properties." Right-click the column header of the first column (the one with the properties you wish to copy), then select "Copy Column Properties." Then, select one or more other columns, right-click the column header, then select "Paste Column Properties."
Hope this helps!
Julian
Hi,
sorry for not mentioning this earlier but i would like to do this via code as to keep track of the changes i did to the original file as you show in your great presentation "The Scientific Workflow in JMP: Creating Reproducible Analyses"
TIA, Eli
Hi @eliyahu100,
As you discovered you can send individual messages to the column to set the specific properties you want, and the way to capture the script for all those changes from an existing column is to use the "Copy Column Properties" command-- and it looks like you've done that in the commented out part of your script. By sending that entire block of jsl as a message to a column JMP should set all those properties for that existing column. You'd just need two changes to what you've done already, which is to explicitly indicate the property you're trying to set with "numeric" and "nominal."
:gender << Add Column Properties( Data Type("Numeric"), Modeling Type("Nominal"), Format("Best", 15), Value Labels( {0 = "Male", 1 = "Female"} ), Use Value Labels( 1 ));
This is what I need, but I use JMP 15 and there is no icon of 'Add-ins' on my JMP at all. Is this only for Pro? What is the steps that I can get this function. Thanks.
Hi @Isabel26 - once you download the Add In, open it on your computer and JMP will prompt you about installing the Add In. Allow the Add In to be installed, and then you will have an Add-Ins menu.
@julian Thanks! This is very helpful!. But lots of times, The scripts that I get from this Add-ins including all the data values and make the script unable to be a generic scrip to reproduce same procedure for later project. For instance, I deleted a column and the script I got from this contains all the data values in this column including the changes. Am I missing anything? Thanks.
Hi @Isabel26,
You're not doing anything incorrect -- the point of this Add In is to copy the column including everything, which includes the name, formatting, formula (if present), and raw values if that's what is contained in the column. The most common way I see this used is for when you have many formula columns you have made that you would like to save the script for so you can add them to a new table at a later time.
Incredibly useful.
Intreresting that such a functionality is not available by the std. jmp program via right click context menu
-> ah, I almost suspected it, there it is ...