Separate positive and negative values
Posted: Wed Aug 02, 2017 3:54 am
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"
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"