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!
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=""></RERUN>
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
Re: Col Score in reverse order options?Thanks for the help @jthi and @txnelson . Using your guidance, I came up with this that is working well
For use with a single column
Col Score( :height ) * -1 + 1 + Col Maximum( Col Score( :height ) )
For use with by columns:
Col Score( :height, :sex ) * -1 + 1 + Col Maximum( Col Score( :height, :sex ), :sex )
Appreciate the quick responses!
Steve