sort |

Sort the series in a graph.

The sort command sorts all series in the graph on the basis of the values of up to three series. For purposes of sorting, NAs are considered to be smaller than any other value. By default, EViews will sort the series in ascending order. You may use options to override the sort order.

Note that sorting cannot be undone. You may wish to freeze or copy the graph before applying the sort.

Syntax

graph_name.sort(series1[, series2, series3])

Follow the keyword with a list of the series by which you wish to sort the graph. If you list two or more series, sort uses the values of the second series to resolve ties from the first series, and values of the third series to resolve ties from the second.

The series may be specified using the series display name or the index of the series in the graph. For example, if you provide the integer “2”, EViews will use the second series. To sort by observation labels, use the integer “0” or the keyword “Obs label”.

To sort in descending order, precede the series name with a minus sign (“-”).

Note that a graph with more than 500 observations cannot be sorted.

Examples

gra1.sort(x,y)

sorts graph GRA1 first by the series X. Any ties in X will be resolved by the series Y.

If X is the first series in graph GRA1 and Y is the second series,

gra1.sort(1,-2)

sorts first in ascending order by X and then in descending order by Y.

gra1.sort(0)

sorts GRA1 by its observation labels.