I have a work file from 2011M01 to 2018M12
The last date I have data for is 2018M06.
I need a away to automatically calculate the average of a variable over the last 12 months and dump it into a scalar.
I had tried smpl @last-12 @last but that does not work, as it does to the end of the workfile that has no data in it (data only does to june 2018).
Is there a way to get the last non-missing data point date (june 2018 in this case), have that be the end point, and then subtract 12 from it to get to the start?
for example
smpl date of last data point minus 12 date of last data point
scalar test = @mean(data)
smpl @all
Scalar of average of last 12 months
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Non-normality and collinearity are NOT problems!
- Posts: 3775
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Scalar of average of last 12 months
See if @movav helps.
-
- EViews Developer
- Posts: 560
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Scalar of average of last 12 months
Hello,
Something along this line should work,
Something along this line should work,
Code: Select all
%tmp = @datestr(@dateadd(@dateval(data.@last), -11, "MM")) + " " + data.@last
smpl %tmp
scalar test = @mean(data)
smpl @all
Who is online
Users browsing this forum: No registered users and 14 guests