cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
DataMojo
Level II

Sum specific columns in each row

I would like to sum specific columns in each row.

I can find the maximum value in each row using the below :

location =  Loc Max( dt[r, {a,b,c} );

 

but cannot use the sum 

Total = Sum( dt[r, {a,b,c} );

2 ACCEPTED SOLUTIONS

Accepted Solutions
DataMojo
Level II

Re: Sum specific columns in each row

Worked around, by hard coding the column names :

For Each Row(
r = Row();

Column = (:Name( "COL1" )) / (:Name( "COL23" ) + :Name( "COL24" ) + :Name( "COL25" )) ;

);

View solution in original post

Craige_Hales
Super User

Re: Sum specific columns in each row

Maybe a missing ] ?  This works for me.

dt=open("$sample_data/big class.jmp");
sum(dt[3,{height,weight,age}]);

Maybe the r variable is uninitialized. Use show(r); to see what it is. Check the JMP log window for messages. 

Not sure why you would add these togetherNot sure why you would add these together

 

Craige

View solution in original post

2 REPLIES 2
DataMojo
Level II

Re: Sum specific columns in each row

Worked around, by hard coding the column names :

For Each Row(
r = Row();

Column = (:Name( "COL1" )) / (:Name( "COL23" ) + :Name( "COL24" ) + :Name( "COL25" )) ;

);

Craige_Hales
Super User

Re: Sum specific columns in each row

Maybe a missing ] ?  This works for me.

dt=open("$sample_data/big class.jmp");
sum(dt[3,{height,weight,age}]);

Maybe the r variable is uninitialized. Use show(r); to see what it is. Check the JMP log window for messages. 

Not sure why you would add these togetherNot sure why you would add these together

 

Craige

Recommended Articles