how to sort only one series

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

sliang
Posts: 6
Joined: Thu May 14, 2009 2:34 am

how to sort only one series

Postby sliang » Thu May 14, 2009 3:00 am

dear all,
can you help me to sort only one series in ascending order in version 5?
i think series.sort is not available in version 5.
thanks,
sliang

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: how to sort only one series

Postby trubador » Thu May 14, 2009 3:17 am

I think the correct syntax would be:

Code: Select all

sort series

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13323
Joined: Tue Sep 16, 2008 5:38 pm

Re: how to sort only one series

Postby EViews Gareth » Thu May 14, 2009 8:12 am

Unfortunately that would sort the other series in the workfile by the target series too.

Other than by copying that single series into a new page, sorting that page, then copying it back, I cannot think of a way to do this in EViews 5.
Follow us on Twitter @IHSEViews

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: how to sort only one series

Postby trubador » Thu May 14, 2009 9:05 am

How about this?

Code: Select all

stom(series_y,vector_y)
vector sort_y = @sort(vector_y)
mtos(sort_y,series_y)
delete vector_y sort_y


Edit: Gareth was right and I corrected the mistake.
Last edited by trubador on Thu May 14, 2009 9:11 am, edited 1 time in total.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13323
Joined: Tue Sep 16, 2008 5:38 pm

Re: how to sort only one series

Postby EViews Gareth » Thu May 14, 2009 9:05 am

That works in 6 (although I think you've got the second mtos wrong - you probably want sort_y not vector_y), but @sort was not implemented in EViews 5.
Follow us on Twitter @IHSEViews

sliang
Posts: 6
Joined: Thu May 14, 2009 2:34 am

Re: how to sort only one series

Postby sliang » Thu May 14, 2009 7:46 pm

Thank you for your reply.
I wrote part of the program like this,
1. pagecopy(page=temp) x
2. sort x
3. copy x dest_name
4. pageselect untitled

I cannot figure out how to copy the sorted series
x in the newly created page, i.e., temp, back to
the original page, i.e., untitled.
In other word, how to refer the dest_name to the
original page in the third line above.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13323
Joined: Tue Sep 16, 2008 5:38 pm

Re: how to sort only one series

Postby EViews Gareth » Thu May 14, 2009 7:57 pm

You want something like this:

Code: Select all

copy temp\x untitled\x
Follow us on Twitter @IHSEViews

sliang
Posts: 6
Joined: Thu May 14, 2009 2:34 am

Re: how to sort only one series

Postby sliang » Thu May 14, 2009 8:08 pm

It did not work because I've got an error message that says 'temp\x' is not defined.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13323
Joined: Tue Sep 16, 2008 5:38 pm

Re: how to sort only one series

Postby EViews Gareth » Thu May 14, 2009 8:13 pm

A full set of commands would be something like:

Code: Select all

pagecopy(page=temp) x
sort x
copy temp\x untitled\x
pagedelete temp


I presume you have EViews 5.1?
Follow us on Twitter @IHSEViews

sliang
Posts: 6
Joined: Thu May 14, 2009 2:34 am

Re: how to sort only one series

Postby sliang » Thu May 14, 2009 8:19 pm

I bought and installed it around July 2004.
I am not so sure which version is it.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13323
Joined: Tue Sep 16, 2008 5:38 pm

Re: how to sort only one series

Postby EViews Gareth » Thu May 14, 2009 8:34 pm

help->about EViews
Follow us on Twitter @IHSEViews

sliang
Posts: 6
Joined: Thu May 14, 2009 2:34 am

Re: how to sort only one series

Postby sliang » Thu May 14, 2009 8:56 pm

Eviews 5.0

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13323
Joined: Tue Sep 16, 2008 5:38 pm

Re: how to sort only one series

Postby EViews Gareth » Thu May 14, 2009 9:05 pm

Follow us on Twitter @IHSEViews

sliang
Posts: 6
Joined: Thu May 14, 2009 2:34 am

Re: how to sort only one series

Postby sliang » Thu May 14, 2009 9:18 pm

It worked.
Thank you very much.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 33 guests