Page 1 of 1

value of last observation

Posted: Tue Jun 30, 2015 2:02 pm
by miorinnovo
I know this is simple but I can't find the answer in the manual. Whats the command that will give me the value of the last observation in a series?

Re: value of last observation

Posted: Tue Jun 30, 2015 2:17 pm
by EViews Gareth
Series.@last

Re: value of last observation

Posted: Tue Jun 30, 2015 2:34 pm
by miorinnovo
I tried that but it gives me the date of the last observation, not the value.

Re: value of last observation

Posted: Tue Jun 30, 2015 2:56 pm
by EViews Gareth
@last(seriesname)

Re: value of last observation

Posted: Tue Jun 30, 2015 3:18 pm
by miorinnovo
It says cannot assign numeric expression to string variable. The observations are dates, maybe that's the problem.

Re: value of last observation

Posted: Tue Jun 30, 2015 3:21 pm
by EViews Gareth
Sounds like you're trying to assign the value into a string, not a number.

Re: value of last observation

Posted: Wed Jul 01, 2015 6:55 am
by miorinnovo
My series is a list of observations and I'm trying to figure a way to use the first/last in the list to change the sample range, any idea on how to do that?

Re: value of last observation

Posted: Wed Jul 01, 2015 7:59 am
by EViews Gareth
Grab the date as a number, the use @datestr to convert to a string that smpl will understand

Re: value of last observation

Posted: Wed Jul 01, 2015 1:19 pm
by miorinnovo
Do you mean something like

smpl 2000 @datestr(@last(seriesname))?

That gives me an error saying its an illegal date.

Re: value of last observation

Posted: Wed Jul 01, 2015 2:19 pm
by EViews Gareth

Code: Select all

%date = @datestr(@last(seriesname)) smpl 2000 {%date}

Re: value of last observation

Posted: Wed Jul 01, 2015 3:03 pm
by miorinnovo
Thanks Gareth