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
- :
- Why is there no "col mode" function?

Topic Options

- 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

Feb 16, 2018 6:41 PM
(1323 views)

I'm a student learning with JMP, and I need to use the mode of a data table column in a conditional formula. JMP has col mean, col max, and several others, but no col mode. What is the reason, and what is the workaround?

I humbly acknowledge that I'm asking out of ignorance, but I've found no similar questions online, which usually means I'm using the wrong terms or the answer is obvious to those already in the field.

Thanks for your help!

1 ACCEPTED SOLUTION

Accepted Solutions

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

There is also a mode function that finds the most common value in a matrix; you can turn it into a column function like this:

```
dt = Open( "$sample_data\big class.jmp" );
dt << New Column( "age centered on mode",
formula( :age - As Constant( Mode( dt:age << getvalues ) ) )
);
```

The <<getValues message returns a matrix of values from the age column. The AsConstant function calculate the mode once, and treats that value as a constant for the rest of the column (speeds it up, not strictly necessary).

You can change mode to mean and see a different set of numbers.

Craige

3 REPLIES 3

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

Re: Why is there no "col mode" function?

See Craige's response below....it answers the question better

1. If you go to

Help==>Statistics Index

and scrolled down to "Mean" you would see where it is surfaced in JMP

2. It is available under the red triangle options in the Distribution Platform

Display Options==>Customize Summary Statistics

Jim

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

There is also a mode function that finds the most common value in a matrix; you can turn it into a column function like this:

```
dt = Open( "$sample_data\big class.jmp" );
dt << New Column( "age centered on mode",
formula( :age - As Constant( Mode( dt:age << getvalues ) ) )
);
```

The <<getValues message returns a matrix of values from the age column. The AsConstant function calculate the mode once, and treats that value as a constant for the rest of the column (speeds it up, not strictly necessary).

You can change mode to mean and see a different set of numbers.

Craige

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

Re: Why is there no "col mode" function?

Feb 17, 2018 6:21 PM
(1271 views)
| Posted in reply to message from Craige_Hales 02/17/2018 06:24 AM

Thanks for the input!

I'm not sure that my original question was clear, but based on your suggestions I was able to creat this solution:

```
If( Is Missing( :OCCUP_CD ),
Mode( :OCCUP_CD << get values ),
:OCCUP_CD
)
```

The one snag I hit is that the mode for one column is "missing" (there are more missing values than any other category).