A very simple (stupid?) trick.
Many models include conceptually null variables (like exports from a country to itself.... When you compare the relative difference between two simulations, or simulations and historical, EViews will divide zero by zero, giving a NA value and an annoying error message.
From an economic point of view, an absolute error of zero means there is no error, so the relative error should also be zero, even starting from a zero value.
To avoid this, you should give you just have to add to the numerator a condition, testing if the variable is null.
Instead of :
genr pc_x = 100 * (x_1 - x_0) / x_0
you will use :
genr pc_x = 100 * (x_1 - x_0) / (x_0+(x_0=0))
If x_0 <> 0, the condition is false, giving zero, and the computation is performed normally.
If x_0 = 0, the condition gives 1, and the result is 0 / 1 = 0
0 / 0 = 0
Moderators: EViews Gareth, EViews Moderator
Return to “General Information and Tips and Tricks”
Who is online
Users browsing this forum: No registered users and 2 guests
