cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
lala
Level VIII

How does JSL implement the sorting of memory arrays?

Thanks!

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
ar = dt << GetAsMatrix( {2, 4} );
ar << Sort( By( 1 ), Order( Descending ), replace table );//??
  • Of course, this code is just a try.

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: How does JSL implement the sorting of memory arrays?

You might find something in Sorting Lists  useful. The Rank() function is often overlooked.

Craige

View solution in original post

2 REPLIES 2
jthi
Super User

Re: How does JSL implement the sorting of memory arrays?

You can sort vectors and lists but I'm not sure if you can sort matrix by specific column. But you can always convert that matrix to private table, sort it and get it back into matrix.

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
ar = dt << GetAsMatrix({2, 4});

dt_m = As Table(ar, <<private);
dt_m << Sort(By(1), Order(Descending), Replace Table);

ar1 = dt_m[0,0];
Close(dt_m, no save);

show(ar, ar1);
-Jarmo
Craige_Hales
Super User

Re: How does JSL implement the sorting of memory arrays?

You might find something in Sorting Lists  useful. The Rank() function is often overlooked.

Craige