Subscribe Bookmark RSS Feed

automatic formulas

tonyuow

Community Trekker

Joined:

Dec 20, 2011

let's say I have 5 columns: A, B, C, D and E. I want to automatically generate new columns where each first four columns are divided by the fifth one, i.e. new columns are: A/E, B/E, C/E and D/E. Is there any way to do that automatically in JMP?

thanks

3 REPLIES
ms

Super User

Joined:

Jun 23, 2011

With JSL, yes. It pays off to learn JSL if plan to use JMP a lot.

For your specific example it be done like this:

For( i = 1, i <= 4, i++,

  Current Data Table() << New Column( Column( i ) << get name || "/E",

                    values( (Column( i ) << getas matrix) :/ (Column( 5 ) << get as matrix) )

          )

);

Paste the code in a new script window, make sure your target  table is the frontmost data table and hit run.

XanGregg

Staff

Joined:

Jun 23, 2011

The way to do this without scripting is the "Substitute Column Reference" feature in Cols > Standardize Attributes. There's an example in the doc for making 9 new columns that is each the log of a previous column.

ms

Super User

Joined:

Jun 23, 2011

I never noticed the checkbox "Substitude Column Reference" before. Smart feature. Thanks!