Am 10.10.2016 um 08:44 schrieb guido giaume:
Hi all I am unable to sort a matrix and sorting the same colname. E.G. matrix M = {Class_A..Class_D} colnames(M, "Class_A Class_B Class_C Class_D") A = dsort(M) printing A I see the right numerbs but the wrong colnames and despite my research in the Gretl User?s Guide I was unable to find myself the solution.
Hi Guido, what gretl version are you using? According to the dsort() documentation it doesn't apply to a matrix that is not a vector (more than one column). And indeed here for me I get an (expected) error when I try dsort(m) where m has two columns. Also it is not clear to me what you want to achieve. Perhaps the msortby() function is right for you. cheers, sven

Dear Sven 
thanks for your quick answer.

My Gretl version is 2016-c but it does not matter.


You are right, I didnt tell all the story. But was not for cheating. I tried to cut short the description of the problem. 

I mentioned a matrix, but indeed I was working with a 1 row "matrix". 


My  real problem is ranking some time series, day by day; 
And the trouble is the sorting mismatch the names of the series with their values.

(E.G.) If I have  A, B, C, D daily series and I want (recursively) rank their values at day t, and then at day t+1, and so on, I am in trouble, 
because all my attempt of sorting does not keep the values with the original series names, while in Excel is trivial.

I tried in many ways, unsuccessfully. 

My last attempt was
a) limiting the whole dataset to only 1 day, (by smpl)
b)  declaring it as a one row matrix
c) giving it the right names (via colnames)
d) ranking the values 

but as before, I got the (values) rank but I lost the match with the names of time series.

So any help, or reference to the User Guide, will be greatly appreciated.

Guido