smpl YTD

For questions regarding programming in the EViews programming language.

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

trymok
Posts: 7
Joined: Fri Jun 14, 2019 1:02 am

smpl YTD

Postby trymok » Wed Sep 11, 2019 2:05 am

Hi,

I have a series on monthly frequency.
I would like to set the sample so that I get the monthly data from the start of the year (january) until the current month summarized (or year to date) in the current year and the past five years.

For example, I want to know the number of houses sold from january until august in 2019. I also want to know the numbers of houses sold from january until august in 2018, 2017, 2016 etc. by setting the sample.

Is this possible?

I tried something like this, but it didn't work:

Code: Select all

%thismonth=@datestr(@dateadd(@now, "0", "M"), "MM") 'returns current month
%startyear=@datestr(@dateadd(@now, "-4", "Y"), "YYYY") 'setting the startyear. 2015 in this case.
!s={%thismonth}-1 'this returns the number of the month with the last available observation.
smpl %startyear @now if @month< !s


Mvh. Trym

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

Re: smpl YTD

Postby EViews Gareth » Wed Sep 11, 2019 5:20 am

Sounds like you just want the @ytd function?

http://www.eviews.com/help/helpintro.ht ... tions.html
Follow us on Twitter @IHSEViews

trymok
Posts: 7
Joined: Fri Jun 14, 2019 1:02 am

Re: smpl YTD

Postby trymok » Wed Sep 18, 2019 12:00 am

EViews Gareth wrote:Sounds like you just want the @ytd function?

http://www.eviews.com/help/helpintro.ht ... tions.html


Yes, you are right! Thank you!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 12 guests