evaluating condition in a model

For technical support, tips and tricks, suggestions, or any other information regarding the EViews model object.

Moderators: EViews Gareth, EViews Moderator

zezza
Posts: 23
Joined: Fri May 28, 2010 5:27 am

evaluating condition in a model

Postby zezza » Sun May 06, 2018 8:58 am

I have the following problem: I want to specify a variable according to a condition

Code: Select all

test.append eta = (dcd=0)*0+(dcd<>0)*(2/dcd)
test.append dcd = cd-cd(-1)

I want Eviews to assign the value zero to ETA when the denominator of the resulting ratio would be zero, and compute a ratio otherwise.
The problem is that when DCD assumes a zero value, Eviews returns an error message when solving the model (unable to compute due to missing data)

How can this be specified?

Thank you!

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

Re: evaluating condition in a model

Postby EViews Gareth » Sun May 06, 2018 9:12 am

zezza wrote:I have the following problem: I want to specify a variable according to a condition

Code: Select all

test.append eta = (dcd=0)*0+(dcd<>0)*(2/dcd)
test.append dcd = cd-cd(-1)

I want Eviews to assign the value zero to ETA when the denominator of the resulting ratio would be zero, and compute a ratio otherwise.
The problem is that when DCD assumes a zero value, Eviews returns an error message when solving the model (unable to compute due to missing data)

How can this be specified?

Thank you!

Have you tried a @recode?
Follow us on Twitter @IHSEViews

zezza
Posts: 23
Joined: Fri May 28, 2010 5:27 am

Re: evaluating condition in a model

Postby zezza » Mon May 07, 2018 8:10 am

Thank you, this has fixed the problem!


Return to “Models”

Who is online

Users browsing this forum: No registered users and 5 guests