I have a matrix A in STATA and I want to obtain a new matrix B with the same contents as A but with its columns reordered according to the values of a given row.
For example, if A looks like:
1 2 3
6 8 7
I want to reorder this based on the second row to obtain B:
1 3 2
6 7 8
Is there a straightforward way of doing this in STATA without having to use MATA commands? I'm not familiar with them but willing to learn if needed.
0 Response to Reorder a matrix columns according to the values of one of its rows
Post a Comment