cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
mad
mad
Level III

Copy Columns With Formulas

Is it possible to copy columns along with their formulas from one table to another? I have a table with 21 columns, each with their own unique formula, and I need to apply those formulas to a new dataset. Without having to copy the formulas one at a time, how do I do this?
1 ACCEPTED SOLUTION

Accepted Solutions
mad
mad
Level III

Re: Copy Columns With Formulas

MS,

Working the problem the other way around as you suggested worked the easiest for me. I tried LauraL's suggestion, but ran into big trouble when I tried to run get script; with all the data still in the table. Once I deleted all the data get script; worked fine, and I'll be sure to keep that in my bag of tricks, but once I have all the data deleted it's just as easy to save that reduced table as a template then copy in the new data as required.

Thanks to everyone for all your help,

Mark

View solution in original post

5 REPLIES 5
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Copy Columns With Formulas

I don't know. I remember vaguely that there was a trick in a much earlier version of JMP, but I can't figure it out now in JMP 8.

However, why not do it the other way around? Paste the new data set in a copy of the table where you keep your formulas. If the new set is smaller (=fewer rows) than the old you may need to delete redundant rows first.

Or alternatively from the Tables menu, choose "Join" or "Subset" and "Join" in series to combine the formulas with the new data ("copy formulas" must be checked).
mad
mad
Level III

Re: Copy Columns With Formulas

MS,

Working the problem the other way around as you suggested worked the easiest for me. I tried LauraL's suggestion, but ran into big trouble when I tried to run get script; with all the data still in the table. Once I deleted all the data get script; worked fine, and I'll be sure to keep that in my bag of tricks, but once I have all the data deleted it's just as easy to save that reduced table as a template then copy in the new data as required.

Thanks to everyone for all your help,

Mark
aim
aim
Level II

Re: Copy Columns With Formulas

Try the following script. To use it:

- on a dialog window select a radio button with data table from which you want to copy columns with formula;click "Copy Formula"

- edit script in the script window, if needed;

- select new data table in which new columns with formula need to be created; click "Paste Formula". The script will run against selected table.

Hope this helps.

mad
mad
Level III

Re: Copy Columns With Formulas

aim,

After I played around with LauraL's suggestion, I gave your response a try and it works brilliantly! Thank you so much!

Mark
laural
Level I

Re: Copy Columns With Formulas

If you need to repeated add the same formula columns to new data tables, you are better off creating a script with those columns.

The easiest way is to get the script for the original data table.

data table("Original") << get script;

Now the script appears in the log. Just copy and paste into a new script, keeping only the bits related to adding the the formula columns.

Note that you may need to reformat the script once you paste it in. On my computer it appears on one row until after reformatting.