Page 1 of 1
Creating Dummies for calendar effects (3)
Posted: Thu Apr 26, 2012 12:33 pm
by Sissy
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
Re: Creating Dummies for calendar effects (3)
Posted: Thu Apr 26, 2012 4:47 pm
by EViews Glenn
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.
Re: Creating Dummies for calendar effects (3)
Posted: Fri Apr 27, 2012 12:00 am
by Sissy
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.
Re: Creating Dummies for calendar effects (3)
Posted: Fri Apr 27, 2012 8:52 am
by EViews Esther
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
Re: Creating Dummies for calendar effects (3)
Posted: Fri Apr 27, 2012 8:57 am
by Sissy
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.
Re: Creating Dummies for calendar effects (3)
Posted: Fri Apr 27, 2012 11:14 am
by EViews Glenn
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.