BookmarkSubscribe
Choose Language Hide Translation Bar
Highlighted
Community Trekker

## Why is there no "col mode" function?

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Staff (Retired)

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

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). Column using Mode You can change mode to mean and see a different set of numbers. Craige 3 REPLIES 3 Super User ## 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 Staff (Retired) ## Re: Why is there no "col mode" function? 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).

Column using Mode

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

Craige
Community Trekker

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

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).