cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP 19 is here! See the new features at jmp.com/new.
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
Choose Language Hide Translation Bar
lala
Level IX

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

Recommended Articles