@makedate and weeks - unexpected error

For notifying us of what you believe are bugs or errors in EViews.
Please ensure your copy of EViews is up-to-date before posting.

Moderators: EViews Gareth, EViews Moderator

mamo
Posts: 205
Joined: Wed Nov 07, 2012 9:11 am

@makedate and weeks - unexpected error

Postby mamo » Thu Sep 04, 2025 1:54 am

Hi, using Eviews 14 Dec 2024 build.
What is wrong with the following command line? Unexpectedly, it produces the error message "Bad date format 'yyyyww' - Missing data generated."

Code: Select all

series x=@makedate(201143, "yyyyww")

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13583
Joined: Tue Sep 16, 2008 5:38 pm

Re: @makedate and weeks - unexpected error

Postby EViews Gareth » Thu Sep 04, 2025 10:31 am

makedate doesn't support weeks [because a week doesn't identify a date]

mamo
Posts: 205
Joined: Wed Nov 07, 2012 9:11 am

Re: @makedate and weeks - unexpected error

Postby mamo » Fri Sep 05, 2025 1:00 am

p1.png
p1.png (18.47 KiB) Viewed 16980 times
Well, the functions @dateval and @datepart(@date, week) obviously assign 1) a date to a specified week and 2) a week to a specified date, respectively. So there seems to be a uniquely defined link between weeks and dates (as is also the case with months and dates).
So suggestion here. Please make @makedate work also applicable to weeks in future updates of Eviews.

Code: Select all

wfcreate w 2000 2010 show @dateval("2008W33", "yyyy[W]ww") show @date @datepart(@date, "WW")
p2.png
p2.png (24.42 KiB) Viewed 16980 times

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13583
Joined: Tue Sep 16, 2008 5:38 pm

Re: @makedate and weeks - unexpected error

Postby EViews Gareth » Fri Sep 05, 2025 7:50 am

Those two functions are series functions, and so are able to use workfile context to determine the dates that correspond to the weeks (and vice versa). If you create a monthly workfile instead of a weekly workfile, you'll notice that @dateval fails.

@makedate is not a series function and so does not use workfile context.

mamo
Posts: 205
Joined: Wed Nov 07, 2012 9:11 am

Re: @makedate and weeks - unexpected error

Postby mamo » Mon Sep 08, 2025 2:37 am

Hm, @dateval works fine and as expected with a monthly date as argument in any workfile context.
There seems to be an issue with calendar-week dates in Eviews.

Code: Select all

wfcreate m 2000M01 2010M12 show @dateval("2009M04", "yyyy[M]mm")

Code: Select all

wfcreate u 1 show @dateval("2009M04", "yyyy[M]mm")
p2.png
p2.png (3.45 KiB) Viewed 16897 times
p1.png
p1.png (18.47 KiB) Viewed 16897 times

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13583
Joined: Tue Sep 16, 2008 5:38 pm

Re: @makedate and weeks - unexpected error

Postby EViews Gareth » Mon Sep 08, 2025 7:23 am

Right, because months are always defined. Weeks are not a defined concept. There is no defined "Week 1" of a year. That entirely depends on whatever structure the user is using. But January is always the first month of the year.

mamo
Posts: 205
Joined: Wed Nov 07, 2012 9:11 am

Re: @makedate and weeks - unexpected error

Postby mamo » Thu Sep 11, 2025 12:05 am

So here is a workaround for @makedate with years & weeks as arguments not working:
Assume you have an unordered workfile containing variables indicating year and week of the year, "year" and "week", respectively. In order to generate a proper date series "date" out of "year" and "week" you may use the following command line:
series date=@dateadd(@makedate(year, "yyyy"), week-1, "WW")
See example code below
Best, mamo

Code: Select all

' Create an unordered workfile containing the variables "year" and "week" wfcreate u 20 series year = 2000+@trend series week = NA rndint(week, 51) week=week+1 sort year week ' create a date series using the variables "year" and "week" series date=@dateadd(@makedate(year, "yyyy"), week-1, "WW") ' crosscheck group gr @datepart(date, "WW") week gr.sheet(c)

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13583
Joined: Tue Sep 16, 2008 5:38 pm

Re: @makedate and weeks - unexpected error

Postby EViews Gareth » Thu Sep 11, 2025 8:18 am

Whether that will give you what you want or not, depends on how you are defining weeks.


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest