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
EH1
EH1
Level III

IDENTIFY LARGEST 3 VALUES TO CREATE INDICATOR COLUMNS

Hi,

I'm a trying to compare across column values (Utility A to Utility E) to identify the largest 3 values and put the results into indicator columns ("Top 3 - A" to "Top 3 - E").  So, if "Utility A" is one of the largest 3 values in the row, "Top 3 - A" would receive a "1".  If the value is NOT one of the 3 largest in the row, "Top 3 - A" would receive a "0". 

 

I tried using "Match", but wasn't able to get it to work.  Appreciate any help folks could provide!

 

Screenshot 2023-09-14 at 9.49.00 AM.png

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: IDENTIFY LARGEST 3 VALUES TO CREATE INDICATOR COLUMNS

Here is a formula that will work.  Just change the comparison column from A to B to etc.

If(
	:"Utility - A"n >= Sort Descending(
		Matrix( :"Utility - A"n ) || Matrix( :"Utility - B"n ) || Matrix( :"Utility - C"n ) ||
		Matrix( :"Utility - D"n ) || Matrix( :"Utility - E"n )
	)[3],
	1,
	0
)
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: IDENTIFY LARGEST 3 VALUES TO CREATE INDICATOR COLUMNS

Here is a formula that will work.  Just change the comparison column from A to B to etc.

If(
	:"Utility - A"n >= Sort Descending(
		Matrix( :"Utility - A"n ) || Matrix( :"Utility - B"n ) || Matrix( :"Utility - C"n ) ||
		Matrix( :"Utility - D"n ) || Matrix( :"Utility - E"n )
	)[3],
	1,
	0
)
Jim
EH1
EH1
Level III

Re: IDENTIFY LARGEST 3 VALUES TO CREATE INDICATOR COLUMNS

Thank you so much, Txnelson!  This is exactly what I needed!  I greatly appreciate you taking the time to share your expertise!!

Recommended Articles