weeks start on a Wednesday witch 05/01/2000 was, for my second series.
b) you make a great effort Mr Gareth i see, just it's help me for my study, i will referenced your program. could you help me
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
Code: Select all
create w 03/01/2000 28/12/2015
for !y=2000 to 2001
%y = @str(!y)
if !y<10 then
%y = "0"+%y
endif
for !w=1 to 53
%w=@str(!w)
if !w<10 then
%w="0"+%w
endif
series d_{%y}_{!w} = @recode(@year=!y and @datepart(@date, "ww")=!w, 1, 0)
next
nextCode: Select all
wfcreate 30min(Mon-Fri,8:00-9:00) 01/01/2000 31/12/2001
for !i=1 to 1563
%i = @str(!i)
if %i<10 then
%i="0"+%i
endif
if %i>=10 and %i<100 then
%i="0"+%i
endif
if %i>=100 and %i<1000 then
%i="0"+%i
endif
series d_{!i}=@recode(@trend+1=!i,1,0)
nextCode: Select all
for !i = 1 to @obsrange
%tmp = @datestr(@dateval(@otod(!i)), "YYYY_MM_DD")
series d_{%tmp} = @obsid = !i
next
Code: Select all
%format = "YYYY_MM"
for !i = 1 to @obsrange
%tmp = @datestr(@dateval(@otod(!i)), %format)
if not @isobject("d_" + %tmp) then
series d_{%tmp} = %tmp = @strdate(%format)
endif
next
1/ i have made a modofication to your code with this:1/ if i understand if we change the first line by (%format = "YYYY_QQ") it gives me dummy with three month for every year at here it's clear for me, supose that i would like to generate dummy for every two month or by fourth month or by sixth month for every year, how can do this.
2/ i have no idea to modified your code to generate dummy for month and take the previous and so on, the problem with the code below that at (d_2001_01) it stat at first month (jan) in year 2001, how can take the year 2000 to considerate (all year 2000 take one). same for the others year 2002 2003...etc
i need this:
d_2000_01 =jan=1
d_2000_02 =from jan 2000 to feb 2000 =1
d_2000_03 =from jan 2000 to mar 2000 =1
...etc
d_2001_01 =from jan 2000 to jan 2001 =1
d_2001_02 =from jan 2000 to feb 2001 =1
....etc
d_2002_01 =from jan 2000 to jan 2002 =1
d_2002_02 =from jan 2000 to feb 2002 =1
....etc
create w 03/01/2000 31/12/2015
for !i=2000 to 2015
%i=@str(!i)
for !j=1 to 12
%j=@str(!j)
if !j<10 then
%j="0"+%j
endif
series d_{%i}_{%j}=@recode(@year=!i and @month<=!j,1,0)
next
next
group g d*
3/ it would be nice to have a function to colorate desired valuein the series or in the group (the value 1 for dummy). :)
Code: Select all
for !i = 2000 to 2015
%year = @str(!i)
for !j = 1 to 12 step 2
%month1 = @str(!j, "i02")
%month2 = @str(!j + 1, "i02")
series d_{%year}_{%month1}_{%month2} = @year = !i and @month >= !j and @month <= !j + 1
next
next
Code: Select all
series d_{%year}_{%month1}_{%month2} = @before(%year + "m" + %month1) or (@year = !i and @month >= !j and @month <= !j + 1)
Code: Select all
!size = 3 'how many weeks per dummy
!first_date_number = @dateval(@otod(1))
for !i = 1 to @obsrange
!week = @datediff(@dateval(@otod(!i)), !first_date_number, "ww")
!id = @floor(!week / !size) + 1
%series_name = "d_" + @str(!id, "i03")
if not @isobject(%series_name) then
series {%series_name} = @floor(@datediff(@date, !first_date_number, "ww") / !size) + 1 = !id
endif
next
Users browsing this forum: No registered users and 2 guests