Due Dates on Weekends

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

WalshN
Posts: 3
Joined: Tue Feb 28, 2017 4:38 pm

Due Dates on Weekends

Postby WalshN » Tue Feb 28, 2017 6:49 pm

Hi, I am new to eviews and am trying to write some code that will set a variable equal to 1 if the date on the 20th of the month is a business day. If it is not a business day then the variable should be equal to 1 on the next business day.

I have written some code which is not quite doing what I would like. I am sure there is also a more efficient way to do this, any help is appreciated. The series is daily 7 day week.

series day_of_week=@weekday

smpl if (day_of_week<6)
series t= @recode(@day=20, 1, 0)

smpl if (day_of_week=6 and @day=20)
series t_sat = @recode(@day=20, 1, 0)
smpl @all
series t_sat =@recode(t_sat=na,0,1)
if t_sat=1 then series t= @recode(@day=22, 1, 0)
endif

smpl if (day_of_week=7 and @day=20)
series t_sun = @recode(@day=20, 1, 0)
smpl @all
series t_sun =@recode(t_sun=na,0,1)
if t_sun=1 then series t= @recode(@day=21, 1, 0)
endif

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

Re: Due Dates on Weekends

Postby EViews Gareth » Tue Feb 28, 2017 7:43 pm

When you say Business Day, are you worried about holidays? If so, do you have a variable that indicates whether a day is a holiday?
Follow us on Twitter @IHSEViews

WalshN
Posts: 3
Joined: Tue Feb 28, 2017 4:38 pm

Re: Due Dates on Weekends

Postby WalshN » Tue Feb 28, 2017 8:21 pm

I am worried about holidays. Currently I am constructing a dummy equal to 1 when there is a public holiday.

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

Re: Due Dates on Weekends

Postby EViews Gareth » Tue Feb 28, 2017 9:46 pm

What's the name of the dummy?
Follow us on Twitter @IHSEViews

WalshN
Posts: 3
Joined: Tue Feb 28, 2017 4:38 pm

Re: Due Dates on Weekends

Postby WalshN » Tue Feb 28, 2017 10:30 pm

public_hol

EViews Matt
EViews Developer
Posts: 161
Joined: Thu Apr 25, 2013 7:48 pm

Re: Due Dates on Weekends

Postby EViews Matt » Wed Mar 01, 2017 11:32 am

I believe the following does what you want utilizing your holiday series public_hol:

Code: Select all

series tmp = (@day = 20 or @nan(tmp(-1), 0) = 1) and (@weekday > 5 or public_hol = 1)
series target = (@day = 20 and tmp = 0) or @nan(@d(tmp) = -1, 0)

Series target is the resulting indicator series, series tmp holds intermediate results and can be deleted. FYI, series tmp is an indicator of non-business days that need to be skipped over.


Return to “General Information and Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 2 guests