Hi!
I need to separate positive and negative values from my file deltaop_us
In the research paper "Oil price shocks and stock market activities: Evidence
from oil-importing and oil-exporting countries" by Yudong Wang (2012)
they use
dopt+=max(0, deltaop_us)
dopt-=min(0, deltaop_us)
and later dopt# E { dopt+,dopt- }
i tried running the code, as well as this code (I got this from another thread on the forum)
Genr Pos_deltaop_us=0.5((@abs(deltaop_us)*deltaop_us))
Genr Neg_deltaop_us=0.5((@abs(deltaop_us)*deltaop_us))
Doing the above, all I could generate was one file with the positive values and a "0" where the negative values were originally.
Does anyone know the solution to my problem?
Thank you for reading!
In addition:
When I try to use genr positive_deltaop_us=max(0,deltaop_us)
It says "Illegal lag or index specification"
Separate positive and negative values
Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator
-
- EViews Developer
- Posts: 563
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Separate positive and negative values
Hello,
The easiest way to do this in EViews is to use samples or @recode. I'll demonstrate an @recode approach:
If you want the filtered out values to be NAs instead of zeros, you can change the last argument to @recode to NA.
The easiest way to do this in EViews is to use samples or @recode. I'll demonstrate an @recode approach:
Code: Select all
genr pos_deltaop_us = @recode(delta_op > 0, delta_op, 0)
genr neg_deltaop_us = @recode(delta_op < 0, delta_op, 0)
If you want the filtered out values to be NAs instead of zeros, you can change the last argument to @recode to NA.
Who is online
Users browsing this forum: No registered users and 31 guests