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.
Related Posts with Reorder a matrix columns according to the values of one of its rows
Drop if 3 consecutive quarters of negative sales growthHey! I have some difficulties to write a proper code to clean my data. The goal is to keep only fir…
how to draw a plot with confidence interval non-parametric regHi, I am using npregress kernel code for my analysis which goes like this: npregress kernel DepVar…
Add missing date, last observationHi, I do have an issue with my dataset. I need to add missing dates and replace the variable "creat…
How to find the amount of gaps in a natural number sequence?Dear Stata community, I have some oddly formatted data, as in the following example dataset: Code:…
Computing Z-Score (risk measure)Hi guys, I´m new here and have just startet do use STATA for my thesis. So basically I´m interested…
Subscribe to:
Post Comments (Atom)
0 Response to Reorder a matrix columns according to the values of one of its rows
Post a Comment