Page 1 of 1

Extracting variable name from Equation output

Posted: Tue Sep 23, 2014 4:08 am
by oren7171
Hi!

I am creating a program that generate a large amount of equation using variables C (constant) X1 X2 X3 X4 X5 and dependent variable IMPORTS.
The program generates equation using all variables or only few of them. C is present in all equations.

What I wish to do is keep track of how many times the coefficient of each variables is negative. So I created a vector to count if a coefficient is negative. In order to make sure the program is counting for the right variable, I need to extract the name of the coefficient from the equations (thus identify if the coefficient of X1 or X4 is negative).

Given an equation with varlist: IMPORTS C X1 X4 X5 and knowing that coefficient C(3) is negative -> this means that the coefficient of X4 is negative.

How would one go about this?

Re: Extracting variable name from Equation output

Posted: Tue Sep 23, 2014 8:23 am
by EViews Gareth
Use the @word function to extract the ith element from the varlist, where i is the index corresponding to a negative coefficient.

Re: Extracting variable name from Equation output

Posted: Wed Sep 24, 2014 1:43 am
by oren7171
I did that and I wanted to use @right in order to extract the number 2 from X2, but it does not work because @word returns a string list and @right has a string as an input.

Re: Extracting variable name from Equation output

Posted: Wed Sep 24, 2014 7:59 am
by EViews Gareth
@word returns a string. You can feed it in to @right just fine.