Hey I have a 5 day week frequency workfile and need to create a series that returns the number of workdays in a month at the moment im using @datediff(@dateceil(@date,"m"),@datefloor(@date,"m"),"b") but this wont work if the first or last day of the month is a weekend
Thanks
number of workdays
Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13330
- Joined: Tue Sep 16, 2008 5:38 pm
Re: number of workdays
I'd do it just by creating a temporary monthly page.
Code: Select all
wfcreate(page=daily) d5 2000 2024
pagecreate(page=monthly) m 2000 2024
series days = @daycount("Mon-Fri")
copy monthly\days daily\days
pageselect daily
Follow us on Twitter @IHSEViews
-
- Posts: 8
- Joined: Mon Mar 11, 2024 6:09 am
Re: number of workdays
Thanks that makes sense is it easy to get the first and last workday as a date from the temp monthly page?
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13330
- Joined: Tue Sep 16, 2008 5:38 pm
Re: number of workdays
Create a series equal to @date on the daily page. Copy it over to the monthly page using "first" as the frequency conversion. Then copy it again using "last" as the frequency conversion. That will give you a series of the dates of the first workday and last weekday of each month.
Follow us on Twitter @IHSEViews
-
- Posts: 8
- Joined: Mon Mar 11, 2024 6:09 am
Re: number of workdays
Thanks it would be great if there was a command that could do this or add in an option in dateceil and datefloor for workdays
-
- EViews Developer
- Posts: 564
- Joined: Thu Apr 25, 2013 7:48 pm
Re: number of workdays
Hello,
I'll contribute the following snippet. So long as the very first and last months are fully included within the D5 workfile range, the following expression will generate the number of business days in the current month:
I'll contribute the following snippet. So long as the very first and last months are fully included within the D5 workfile range, the following expression will generate the number of business days in the current month:
Code: Select all
@maxsby(@periodtodate(1, @month), @month, @year)
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13330
- Joined: Tue Sep 16, 2008 5:38 pm
Who is online
Users browsing this forum: No registered users and 4 guests