Page 1 of 1

Re: Creating Dummies for calendar effects (2)

Posted: Wed Apr 25, 2012 3:58 am
by trubador
There is more than one way to do that. Below you can find two of them:

Code: Select all

%may = "05/01 05/02 05/03" %oct= "09/30 10/01 10/02 10/03 10/04 10/05 10/06" series dum1 = 0 series dum2 = 0 for !i = 1 to @wcount(%may) dum1 = @recode(@datestr(@date,"MM/DD")=@word(%may,!i),1,dum1) next for !j = 1 to @wcount(%oct) dum2 = @recode(@datestr(@date,"MM/DD")=@word(%oct,!j),1,dum2) next

Code: Select all

%may = "05/01 05/02 05/03" %oct= "09/30 10/01 10/02 10/03 10/04 10/05 10/06" series dum1 = 0 series dum2 = 0 smpl if @datestr(@date,"MM/DD")>=@wleft(%may,1) and @datestr(@date,"MM/DD")<=@wright(%may,1) dum1 = 1 smpl if @datestr(@date,"MM/DD")>=@wleft(%oct,1) and @datestr(@date,"MM/DD")<=@wright(%oct,1) dum2 = 1 smpl @all

Re: Creating Dummies for calendar effects (2)

Posted: Wed Apr 25, 2012 4:58 am
by Sissy
Thanks a lot for these 2 codes.
However,the first code did not work because the Eviews 7 Student Version does not provide programs apparently.
So I tried the second code, but an error message tells me "Error in the sample: the %MAY is not defined ". Could you help me to resolve this problem, please ?

Thanks in advance.

Re: Creating Dummies for calendar effects (2)

Posted: Wed Apr 25, 2012 5:50 am
by trubador
This should work:

Code: Select all

string may = "05/01 05/02 05/03" string oct= "09/30 10/01 10/02 10/03 10/04 10/05 10/06" series dum1 = 0 series dum2 = 0 smpl if @datestr(@date,"MM/DD")>=@wleft(may,1) and @datestr(@date,"MM/DD")<=@wright(may,1) dum1 = 1 smpl if @datestr(@date,"MM/DD")>=@wleft(oct,1) and @datestr(@date,"MM/DD")<=@wright(oct,1) dum2 = 1 smpl @all

Re: Creating Dummies for calendar effects (2)

Posted: Wed Apr 25, 2012 5:56 am
by Sissy
Thanks a lot. It totally works :lol:

Re: Creating Dummies for calendar effects (2)

Posted: Fri Apr 27, 2012 12:04 am
by Sissy
Hello,

I have another problem considering non-fixed holiday periods:

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.

Could you help me to resolve my problem, please ?

Thanks.

Re: Creating Dummies for calendar effects (2)

Posted: Fri Apr 27, 2012 8:57 am
by EViews Esther
This will work.

Code: Select all

%holidays= "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 dummy = 0 for !i = 1 to @wcount(%holidays) dummy = @recode(@datestr(@date,"MM/DD/YYYY")=@word(%holidays,!i),1,dummy) next smpl @all