Page 1 of 1
Program series with minimal values
Posted: Wed Apr 18, 2012 8:47 am
by Martijn
Hello,
I am trying to create a series ORDERQ (order_quantity) for which the values in time (sample 2012:01 to 2012:12) are conditional to the values of two other series BEGINQ (beginning_volume_on_stock) and SALES (estimated_sales_volume). For each period in the sample if SALES is lower than BEGINQ the given value of ORDERQ should be zero, else it should give SALES-BEGINQ.
I tried several IF THEN ELSE commands but somehow it didn't give me the right results.
Can someone advise?
Martijn
Re: Program series with minimal values
Posted: Wed Apr 18, 2012 9:10 am
by EViews Gareth
Code: Select all
group g beginq sales
series orderq = @rmin(g)
Re: Program series with minimal values
Posted: Wed Apr 18, 2012 9:16 am
by startz
Code: Select all
group g beginq sales
series orderq = @rmin(g)
Shouldn't it be
Code: Select all
series orderq = @recode(sales<beginq,0,sales-beginq)
Program series with minimal values
Posted: Wed Apr 18, 2012 9:36 am
by EViews Gareth
Yes, I misread.
Re: Program series with minimal values
Posted: Wed Apr 18, 2012 9:59 am
by Martijn
Dear startz and eviews gareth,
Thank you for the reply.
Reviewing both options:
The @RMIN option may not work as I guess it return minus values where it should put zeros.
I tried the @Recode command but I get message "recode is not a genr or expression function" (by the way I get a similar message when I enter the @RMIN command). Maybe this is because I am using a old version of Eviews (2.0).
Furthermore I am not sure whether the recode command works as the beginning stock balances depend on the order and sales quantity one period back. So I need a dynamic calculation. How could I best do this?
Re: Program series with minimal values
Posted: Wed Apr 18, 2012 10:05 am
by startz
I think EViews 2 is nearly 20 years out of date. You may find what you can do is limited. Having said that, if you want to reference the lagged value of X, write X(-1). You may be able to substitute for the @recode function
Code: Select all
series orderq = (sales<beginq)*0 + (1-(sales<beginq))*(sales-beginq)
Re: Program series with minimal values
Posted: Wed Apr 18, 2012 2:26 pm
by Martijn
Dear startz,
This formula works.
Thank you for your help!