Hi,
I am using a D5 workfile, and would like to know if there is a simple way for obtaining the last weekday of each month (as a string or date).
Thanks
checking if date is last weekday of the month
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: checking if date is last weekday of the month
Code: Select all
smpl if @month<>@month(1)
alpha mydate = @datestr(@date, "YYYY-MM-DD")
svector lastdates =@uniquevals(mydate)
Follow us on Twitter @IHSEViews
Re: checking if date is last weekday of the month
Thanks for this. It works. Can you please briefly explain how the second line works? I thought @date returns the current date.
Also how can i change it to weekdays? Right now, it gives the 31st of Jan 2021.
Thanks again
Also how can i change it to weekdays? Right now, it gives the 31st of Jan 2021.
Thanks again
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: checking if date is last weekday of the month
Second line just changes @date into the string representation of the date.
If your workfile is D5, there won't be any weekends in it, so it won't report them.
If your workfile is D5, there won't be any weekends in it, so it won't report them.
Follow us on Twitter @IHSEViews
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: checking if date is last weekday of the month
I should, however, note that the smpl statement will miss the last month in your workfile, so you could modify it with:
Code: Select all
smpl if @month<>@month(1) or @trend=@max(@trend)
Follow us on Twitter @IHSEViews
Re: checking if date is last weekday of the month
Great. Thank you
Who is online
Users browsing this forum: No registered users and 59 guests