Problem with @weekday

For questions regarding programming in the EViews programming language.

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

shm83
Posts: 35
Joined: Tue Sep 10, 2013 5:00 am

Problem with @weekday

Postby shm83 » Thu Jun 05, 2014 3:41 am

Good afternoon.

I have another problem now :s

I want to generate prices during a period, but only from Mon to Fri. I also need a vector with the dates.
Without that constrain it is easy, I have a vector where the first element could be datesvector(1) = @dateval("03/01/2014"), and price(1) = 150
If I want the whole year from that date, those vectors will have 365-59=306 elements, so I could figure out the date of the price(227) just looking at the date of datesvector(227).

The thing is I want to keep only weekdays in the datesvector, but working in an undefined WF.

I was trying something like

Code: Select all

if @weekday(@datestr(datesvector(1),"DD/MM/YYYY"))=5 then datesvector(2)=datesvector(1)+3 else datesvector(2)=datesvector(1)+1 endif
but @weekday function needs no arguments

Any ideas?

Thanks in advance

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Problem with @weekday

Postby trubador » Thu Jun 05, 2014 6:12 am

Code: Select all

@datepart

shm83
Posts: 35
Joined: Tue Sep 10, 2013 5:00 am

Re: Problem with @weekday

Postby shm83 » Thu Jun 05, 2014 8:27 am

thank you trubador. I have being also trying with @datediff and I got something "usable", but your way is much better and easier, that is what I was looking for. Thanks again :)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests