Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- how to apply the same formula to several columns in a table?

Topic Options

- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

how to apply the same formula to several columns in a table?

Apr 28, 2015 11:28 PM
(1646 views)

Hi,

I want to change the values contained in several columns of a database by applying a formula (see the attached example): values in "column a" must be modified according to the formula (a - m1) / m2. Same procedure for "column b" ((b - m1) / m2) and similarly for each column.

Thanks in advance for any advice

2 REPLIES 2

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: how to apply the same formula to several columns in a table?

If you want to change the values in-place, i.e. overwrite the old values, the easiest way is to run a script.

dt = Data Table**(**"test-table"**)**;

cols = dt << **get column names**;

For**(**q = **3**, q <= N Items**(**cols**)**, q++,

For Each Row**(**cols**[**q**][]** = **(**cols**[**q**][]** - cols**[****1****][])** / cols**[****2****][])**

**)**;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: how to apply the same formula to several columns in a table?

Thanks MS, it works very well !