Page 1 of 1

Command to assign the highest of two series

Posted: Tue May 23, 2017 6:59 am
by Marc150
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

Re: Command to assign the highest of two series

Posted: Tue May 23, 2017 7:19 am
by EViews Gareth

Code: Select all

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

Re: Command to assign the highest of two series

Posted: Wed May 24, 2017 8:51 am
by Marc150
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.

Re: Command to assign the highest of two series

Posted: Wed May 24, 2017 8:53 am
by EViews Gareth
Put them in a group and use @rmax