Program series with minimal values

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

Martijn
Posts: 7
Joined: Sun Apr 15, 2012 5:15 am

Program series with minimal values

Postby Martijn » Wed Apr 18, 2012 8:47 am

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

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

Re: Program series with minimal values

Postby EViews Gareth » Wed Apr 18, 2012 9:10 am

Code: Select all

group g beginq sales series orderq = @rmin(g)

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: Program series with minimal values

Postby startz » Wed Apr 18, 2012 9:16 am

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)

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

Program series with minimal values

Postby EViews Gareth » Wed Apr 18, 2012 9:36 am

Yes, I misread.

Martijn
Posts: 7
Joined: Sun Apr 15, 2012 5:15 am

Re: Program series with minimal values

Postby Martijn » Wed Apr 18, 2012 9:59 am

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?

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: Program series with minimal values

Postby startz » Wed Apr 18, 2012 10:05 am

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)

Martijn
Posts: 7
Joined: Sun Apr 15, 2012 5:15 am

Re: Program series with minimal values

Postby Martijn » Wed Apr 18, 2012 2:26 pm

Dear startz,

This formula works.

Thank you for your help!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests