Page 1 of 1

smpl YTD

Posted: Wed Sep 11, 2019 2:05 am
by trymok
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

Re: smpl YTD

Posted: Wed Sep 11, 2019 5:20 am
by EViews Gareth
Sounds like you just want the @ytd function?

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

Re: smpl YTD

Posted: Wed Sep 18, 2019 12:00 am
by trymok
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!