The World Statistics Day celebration continues here in the Community. We all need reliable data for sound decision making. Do you have a data source that you trust most? Head over to Discussions to tell us about it.
Choose Language Hide Translation Bar
Community Manager Community Manager

Copy Script For Selected Column(s) to Clipboard

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.





you saved a lot of time for me, Thanks...


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!



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


Following my second post, I already tried

:Gender << data type(Numeric);

:Gender << Set Modeling Type("Nominal");

:Gender << Value Labels( {0 = "Male", 1 = "Female"} );

:Gender << Use Value Labels( 1 );


col = Column("Gender");

col << Add Column Properties( Numeric, "Nominal", Format("Best", 15),

Value Labels( {0 = "Male", 1 = "Female"} ),

Use Value Labels( 1 )


Both didn’t work…

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 ));
Article Labels
Article Tags