Page 1 of 1

Apply ranks from one matrix to another

Posted: Mon May 17, 2021 4:54 am
by DBW
Hi there,

I'm wondering if there's a quick way to sort the elements of a one matrix according to another?

I currently have two matrices, one containing rates of change for a class of variable (rows = date of observation, columns = variable) and the other containing the weights that apply to each of those variables. I'd like to re-order the columns of this second matrix according to the rank of each variable in the first for each month.

I think @rapplyranks will get me there if I loop through each row, extracting, sorting and @matplace-ing. But I was hoping there might be a shortcut.

Thanks very much.

Re: Apply ranks from one matrix to another

Posted: Tue May 18, 2021 1:57 am
by DBW
Sorry, forgot to mention that I'm running EViews 11.

Re: Apply ranks from one matrix to another

Posted: Tue May 18, 2021 10:09 am
by EViews Matt
Hello,

It sounds like you'll have different orderings for different groups of rows in the matrix, so there's really no better way than to loop through the rows yourself.