Hi,
I have a matrix that is stacked and would like to sort rows based on two of the variables. The matrix looks like this:
What I would like is the following:
i.e. sort on varorder then coeftype.
I have tried Mata with the following code:
However, I can't sort the rlabels.
Does anyone know how I can do this?
Thanks.
I have a matrix that is stacked and would like to sort rows based on two of the variables. The matrix looks like this:
Code:
Variable varorder coeftype number Adj_Age 1 1 5 Adj_Age2 2 1 10 Unadj_Age 1 2 7 Unajd_Age2 2 2 9
Code:
Variable varorder coeftype number Adj_Age 1 1 5 Unadj_Age 1 2 7 Adj_Age2 2 1 10 Unajd_Age2 2 2 9
I have tried Mata with the following code:
Code:
mata: rlabels = st_matrixrowstripe("full") mata: clabels = st_matrixcolstripe("full") mata : st_matrix("sorted", sort(st_matrix("full"), (1,2))) mata: _matrix_list(st_matrix("sorted"),rlabels,clabels)
Does anyone know how I can do this?
Thanks.
Comment