Command to assign the highest of two series

For questions regarding programming in the EViews programming language.

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

Marc150
Posts: 10
Joined: Fri Mar 17, 2017 10:50 am

Command to assign the highest of two series

Postby Marc150 » Tue May 23, 2017 6:59 am

Hi,

Is there a command to assign an observation the highest of two series?

So for example, suppose:
series a=1
series b=2

Is there then a command of the form
series c=@...(a,b)

which would return c=b, because b is greater than a?

In other languages the command 'max' often seems to do this. However, in EViews @max returns the maximum value within a vector.

Thanks,
Marc

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

Re: Command to assign the highest of two series

Postby EViews Gareth » Tue May 23, 2017 7:19 am

Code: Select all

Series cc = @recode(a>b,a,b)

Marc150
Posts: 10
Joined: Fri Mar 17, 2017 10:50 am

Re: Command to assign the highest of two series

Postby Marc150 » Wed May 24, 2017 8:51 am

Thank you.

What about in more general instances? For example, if I wanted to pull out the largest of a list of values, e.g., something of the form:

Series a=@...(b,c,..,z) that would assign a to be the highest of the values from b-z.

I suppose you could do some sort of nested for loop with the @recode command, but that seems unnecessarily complicated.

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

Re: Command to assign the highest of two series

Postby EViews Gareth » Wed May 24, 2017 8:53 am

Put them in a group and use @rmax


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests