Page 1 of 1

### Due Dates on Weekends

Posted: 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

### Re: Due Dates on Weekends

Posted: 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?

### Re: Due Dates on Weekends

Posted: 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.

### Re: Due Dates on Weekends

Posted: Tue Feb 28, 2017 9:46 pm
What's the name of the dummy?

### Re: Due Dates on Weekends

Posted: Tue Feb 28, 2017 10:30 pm
public_hol

### Re: Due Dates on Weekends

Posted: 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.