cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

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

Col Score in reverse order options?

Hey everyone,

Is there an easy way to reverse the order using the Col Score() function?  The default is that it scores it by descending order, so if something has the highest value it is given the highest score and the smallest value is given the score of 1.  I'd like the highest value to be a score of 1 and the lowest value to be the lowest score.

 

Thanks for any input!

2 REPLIES 2
txnelson
Super User

Re: Col Score in reverse order options?

Here is how I would do it

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
New Column( "Score Height",
	formula( col score(:Height))
);
New Column( "Height reverse",
	Formula( col max(:height)-:height + col min(:height))
);
current data table()<<rerun formulas;
New Column( "score Height reverse",
	set each value( col score(:height reverse))
);

current data table() << delete columns(:height reverse);
Jim
jthi
Super User

Re: Col Score in reverse order options?

You can combine it with Col Number for example

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

dt << New Column("Score Height", Formula(Col Score(:height)));
dt << New Column("Score Height Reverse", Formula(Col Number(:height) - Col Score(:height) + 1));

dt << New Column("Score Height by age", Formula(Col Score(:height, :age)));
dt << New Column("Score Height by age Reverse", Formula(Col Number(:height, :age) - Col Score(:height, :age) + 1));

Write();

jthi_0-1790138853222.png

 

-Jarmo

Recommended Articles