Weekly frequency

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

javiersan
Posts: 184
Joined: Mon Jan 19, 2009 8:18 am

Weekly frequency

Postby javiersan » Mon Nov 29, 2010 5:20 am

Hello,

The following file has weekly frequency in a format I am not sure how to make Eviews handle:
wfopen "http://www.reservebank.co.za/internet/P ... -+Sep.xlsx" range="w3" format=(1A)

the format of series01 (the date identifiers) is YYYYMMW where W runs from 1 to 5.

Is there any easy way to properly date this file? Otherwise I suppose what I can do is obtain a calendar day by looking for the day of the first Monday of each month (dfom) and calculate the day as Series DayNb=dfom+(7*(@val(@right(series01,2))-1). Then combine this with the year and month part of the date.

Thanks for your help.

Javier

EViews Chris
EViews Developer
Posts: 161
Joined: Wed Sep 17, 2008 10:39 am

Re: Weekly frequency

Postby EViews Chris » Mon Nov 29, 2010 4:13 pm

Hi Javier,

This is actually a pretty tough one...

EViews only has inbuilt support for 'week in year' rather than 'week in month' so there's not going to be any simple way of doing this.

I'm not actually sure what the definition of 'week in month' is in your excel file. I looked at the calendar around the dates in your file but I couldn't really figure out how weeks were being counted.

For what it's worth, the approach I'd probably try following is to create an empty weekly workfile that spans the dates you need, create a week in month series that matches the definition used in the spreadsheet, and then do an import using a matched read. This is one way of dropping the zero values you seem to have in the workfile for weeks that didn't exist.

The following gets you some of the way there, but I'd need to know exactly what the week in month definition is to get much further.

Code: Select all

'create empty workfile create w 1998-09-14 2010 'calculate week in month series wofm = @datepart(@date, "ww") - @datepart(@datefloor(@date,"month"), "ww") + 1 'import data from spreadsheet (using matched read) import kbp1mb.xlsx range="w3" @id @floor(series01/10000) @floor(@mod(series01/100,100)) @mod(series01,100) @destid @year @month wofm
I think I'm still losing some data values and gaining some zeros because the week in month definition I'm using is not correct.

javiersan
Posts: 184
Joined: Mon Jan 19, 2009 8:18 am

Re: Weekly frequency

Postby javiersan » Mon Nov 29, 2010 5:03 pm

Thanks Chris, I'll play a bit with the code and see if I can get all the dates.

Best regards,

Javier


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests