Page 1 of 1

New Series By Sort

Posted: Sat Feb 06, 2016 2:14 am
by diggetybo
Hey again,

I'm aware of the command

Code: Select all

x.sort(-)
for sorting a series in descending order. However, when I try creating a new series based off that sorted series, it doesn't keep the order. Is there anyway to generate a new series that is a sorted (ascending or descending) version of the original series?

Or alternatively, is there a way to sort the original series so that the sort order sticks and is retrieved as hard values, rather than just for display?

Re: New Series By Sort

Posted: Sat Feb 06, 2016 10:17 am
by EViews Gareth
The only way I think is by converting to vectors, or by doing it element by element.

Wanting to reverse the order of observations is somewhat alien in time series.

Re: New Series By Sort

Posted: Sat Feb 06, 2016 10:36 am
by diggetybo
For sure, it's not for estimation or anything. I'm doing this data manipulation purely for a supplementary visualization.

I have unstructured/undated data, and would like to sort them from high to low (value-wise). How would a vector help with that? I noticed vector and matrix objects don't support the .sort extension. Or is it something different?

Re: New Series By Sort

Posted: Sat Feb 06, 2016 10:43 am
by EViews Gareth

Re: New Series By Sort

Posted: Sat Feb 06, 2016 10:46 am
by diggetybo
Cool now I'm on to something :)

Thanks to you

Re: New Series By Sort

Posted: Sat Feb 06, 2016 10:57 am
by diggetybo
Maybe I'm not out of the woods yet... If @rapplyranks needs a vector with unique integers, then I will need to fill that vector with the right numbers. Does eviews have a way to retrieve an element's magnitude rank within the sample?

Say if I have a continuous series that ranges from 100 (min)to 1000(max) with 200 observations, I'd need some command to know how large that element was. Say if the element was 1000, then it'd be the highest, so 1. Or if it was 945, maybe it'd be something like 7, and so forth all the way to x=100, which should be the lowest, so 200 -- in keeping with the descending order example. Otherwise I'd have no way to assign the right value to the order vector for the @rapplyranks command.

Re: New Series By Sort

Posted: Sat Feb 06, 2016 12:46 pm
by EViews Gareth
@ranks (as mentioned in the example)