cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
schou1994
Level II

How to center data into a new column but only for specific conditions based on other columns?

Hi all,

 

I want to center my data. But the problem is I only want to adjust the data with an average of it's respective category. For example, see table below. What if in the "age adjusted" col, I want the age column data but subtracted by the average of only the age data that has the same "city" and "gender" category?

 

So each age for "san francisco" and "male" would be subtracted by average of 1,2,3 = 2. The formula for new col "center" will use the average including every age in the entire column, right? So that won't work for me..

 

Thanks!!

 

schou1994_0-1613350648089.png

 

1 REPLY 1
txnelson
Super User

Re: How to center data into a new column but only for specific conditions based on other columns?

The formula to use is

:Age - Col Mean( :Age, :City, :Gender )

The data table with the formula is attached

The Col Mean() formula is documented in the Scripting Index available under the Help pull down menu

Jim

Recommended Articles