Page 1 of 1

Max

Posted: Mon May 09, 2011 8:26 am
by basil
Hi there, this is probably a very simple question- what is the right syntax for the following arguments:

(1) vector(3) xxx=(1 2 3)
(2) scalar a=@max(1 2)

Thanks
Basile

Re: Max

Posted: Mon May 09, 2011 8:39 am
by EViews Gareth
I don't understand the question.

Re: Max

Posted: Mon May 09, 2011 9:06 am
by basil
(1) I am trying to declare a vector and assign values, but the syntax "vector(3) xxx=(1 2 3)" generates an error. What is wrong with it?
(2) I am trying to apply to the max function on two scalars ("s1" and "s2"), but the syntax "a=@max(s1 s2)" generates an error. What is wrong with it?

Any suggestions? Thanks.

Re: Max

Posted: Mon May 09, 2011 9:16 am
by EViews Gareth
1). I'm not sure where you got that syntax from, but it is not EViews syntax.

Code: Select all

vector(3) xxx xxx.fill 1,2,3
2) Same as above.

Code: Select all

scalar a = @recode(s1>s2, s1, s2)

Re: Max

Posted: Mon May 09, 2011 9:39 am
by basil
Thanks, this is helpful.

(1) As for one, since the following works "vector(3) xxx=x" (where x is a predefined vector or scalar), I thought there is a way to use "1 2 3" instead of x. It looks like I was wrong.

(2) Your proposed solution works. So it looks like @max works only on a predefined matrix and vectors but does not work with scalars.

May I ask one more quick question:
(3) is there a way to delete a specific row (or column) from a matrix? Assume x is 10x5 matrix and I would like to delete the rows (or columns) 3-4? What if want to delete the first 2 rows?

Much appreciated.

Re: Max

Posted: Mon May 09, 2011 9:46 am
by EViews Gareth
You'll have to use the extract functions (@rowextract, @colextract, @subextract) to take the pieces you want into new matrices. There is no delete function for matrices.

Re: Max

Posted: Mon May 09, 2011 11:03 am
by basil
thx v m.