Creating Dummies for calendar effects (3)

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

Sissy
Posts: 30
Joined: Thu Apr 19, 2012 1:59 am

Creating Dummies for calendar effects (3)

Postby Sissy » Thu Apr 26, 2012 12:33 pm

Hello,

I work on daily (7 days) workfile. I try to create a dummy variable for the dates mentioned below in the "string nyr". But it works only for the first three dates. Could someone correct my below code, please ? Thanks in advance.

string nyr= "02/17/2007 02/18/2007 02/19/2007 02/20/2007 02/21/2007 02/22/2007 02/23/2007 02/06/2008 02/07/2008 02/08/2008 02/09/2008 02/10/2008 02/11/2008 02/12/2008 01/25/2009 01/26/2009 01/27/2009 01/28/2009 01/29/2009 01/30/2009 01/31/2009 02/13/2010 02/14/2010 02/15/2010 02/16/2010 02/17/2010 02/18/201 02/19/2010"
series ny= 0
smpl if @datestr(@date,"MM/DD/YYYY")>=@wleft(nyr,1) and @datestr(@date,"MM/DD/YYYY")<=@wright(nyr,1)
ny = 1
smpl @all
Last edited by Sissy on Fri Apr 27, 2012 12:04 am, edited 1 time in total.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Creating Dummies for calendar effects (3)

Postby EViews Glenn » Thu Apr 26, 2012 4:47 pm

You're going to have to provide more information about what you are trying to do and what's going on. I can't follow from the above description.

Sissy
Posts: 30
Joined: Thu Apr 19, 2012 1:59 am

Re: Creating Dummies for calendar effects (3)

Postby Sissy » Fri Apr 27, 2012 12:00 am

Hello Glenn,

Here more information:

Well I need to regress daily (7 weekdays) prices against some monetary policy variables. But in my regression, calendar effects have to be controled. Calendar effects correspond to Chinese holidays. In order to take calendar effects into account, I'd like to create a dummy variable,taking the value 1, for the following Chinese holidays (MM/DD/YYYY) which are not the same for each year:

02/06/2008, 02/07/2008, 02/08/2008, 02/09/2008, 02/10/2008, 02/11/2008, 02/12/2008, 01/25/2009, 01/26/2009, 01/27/2009, 01/28/2009, 01/29/2009, 01/30/2009, 01/31/2009, 02/13/2010, 02/14/2010, 02/15/2010, 02/16/2010, 02/17/2010, 02/18/2010 and 02/19/2010 .

My daily (7 weekdays) sample runs from 12/01/2007 to 04/27/2010.
I hope it's more understable. Could you help me to resolve my problem, please ?

Thanks.

EViews Esther
EViews Developer
Posts: 149
Joined: Fri Sep 03, 2010 7:57 am

Re: Creating Dummies for calendar effects (3)

Postby EViews Esther » Fri Apr 27, 2012 8:52 am

I think that this will work.

Code: Select all

%nyr= "02/17/2007 02/18/2007 02/19/2007 02/20/2007 02/21/2007 02/22/2007 02/23/2007 02/06/2008 02/07/2008 02/08/2008 02/09/2008 02/10/2008 02/11/2008 02/12/2008 01/25/2009 01/26/2009 01/27/2009 01/28/2009 01/29/2009 01/30/2009 01/31/2009 02/13/2010 02/14/2010 02/15/2010 02/16/2010 02/17/2010 02/18/2010 02/19/2010" series ny = 0 for !i = 1 to @wcount(%nyr) ny = @recode(@datestr(@date,"MM/DD/YYYY")=@word(%nyr,!i),1,ny) next smpl @all

Sissy
Posts: 30
Joined: Thu Apr 19, 2012 1:59 am

Re: Creating Dummies for calendar effects (3)

Postby Sissy » Fri Apr 27, 2012 8:57 am

Hello Esther,

thanks for this code. But I forgot to mention that I use Eviews 7 student version. Consequently, loop does not work in the student version.

Is there another way to resolve my problem, please ?

Thanks in advance.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Creating Dummies for calendar effects (3)

Postby EViews Glenn » Fri Apr 27, 2012 11:14 am

The best you can do is to create a dummy for each group by hand. Then sum the dummies together to create a new dummy.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests