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
- :
- Create a new column from others

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

Create a new column from others

Aug 13, 2016 10:09 AM
(1478 views)

I have a set of continuous measures (x1, x2, x3, x4) that are all measured on the same scale. I'd like to create a new nominal variable that identifies for each respondent which of the continuous measures is the maximum (whether x1, x2, etc).

3 REPLIES 3

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

Re: Create a new column from others

One way is to use a column formula including Loc Max() function to identify the column with maximum value.

Example:

// Make example table

dt = New Table**(**"test", add rows**(25****)**, <<**add multiple columns****(**"x", **4**, Numeric**))**;

For**(**i = **1**, i <= N Col**(**dt**)**, i++,

Column**(**i**)** << **Set Formula****(**Random Integer**(****10****))**

**)**;

// Identify the column with highest value for each row

dt << **New Column****(**"max x", Character, Formula**(**"x" || Char**(**Loc Max**(**Matrix**({**x1, x2, x3, x4**})))))**;

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

Re: Create a new column from others

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

Re: Create a new column from others

BTW: If you're not sure how to get to the Formula Editor to create a formula like this, choose **Cols->New Column... **and then choose **Formula** from the **Column Properties** drop down menu.

-Jeff