Date Function

For questions regarding programming in the EViews programming language.

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

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Date Function

Postby rmoralesaramburu » Fri May 16, 2014 4:04 pm

Hello,

I have a problem, I have a series with daily frequency, I would like to fill a vector with only the "Fridays observations" (@weekday=5) and the @last observation. When I smpl if with @weekday=5, I have the problem that if today it is NOT Friday, I will miss the Today observation.

Thanks!!

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

Re: Date Function

Postby EViews Gareth » Fri May 16, 2014 4:45 pm

smpl if @weekday=5 or @date = @datefloor(@now, "d")

or something like that.

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Re: Date Function

Postby rmoralesaramburu » Mon May 19, 2014 7:55 am

Take a look at my solution, is there an easy way to do it?

vector(7) v_z_eem

v_z_eem(1)=@last(z_eem_pc)

smpl @last-@weekday @last-@weekday if @weekday=5
v_z_eem(2)=@last(z_eem_pc)

smpl @last-(@weekday+5) @last-(@weekday+5) if @weekday=5
v_z_eem(3)=@last(z_eem_pc)

smpl @last-(@weekday+10) @last-(@weekday+10) if @weekday=5
v_z_eem(4)=@last(z_eem_pc)

smpl @last-(@weekday+15) @last-(@weekday+15) if @weekday=5
v_z_eem(5)=@last(z_eem_pc)

smpl @last-(@weekday+20) @last-(@weekday+20) if @weekday=5
v_z_eem(6)=@last(z_eem_pc)

smpl @last-(@weekday+25) @last-(@weekday+25) if @weekday=5
v_z_eem(7)=@last(z_eem_pc)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests