Extracting variable name from Equation output

For questions regarding programming in the EViews programming language.

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

oren7171
Posts: 4
Joined: Fri Sep 12, 2014 2:47 am

Extracting variable name from Equation output

Postby oren7171 » Tue Sep 23, 2014 4:08 am

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?

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

Re: Extracting variable name from Equation output

Postby EViews Gareth » Tue Sep 23, 2014 8:23 am

Use the @word function to extract the ith element from the varlist, where i is the index corresponding to a negative coefficient.

oren7171
Posts: 4
Joined: Fri Sep 12, 2014 2:47 am

Re: Extracting variable name from Equation output

Postby oren7171 » Wed Sep 24, 2014 1:43 am

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.

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

Re: Extracting variable name from Equation output

Postby EViews Gareth » Wed Sep 24, 2014 7:59 am

@word returns a string. You can feed it in to @right just fine.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests