value of last observation

For questions regarding programming in the EViews programming language.

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

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

value of last observation

Postby miorinnovo » Tue Jun 30, 2015 2:02 pm

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?

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

Re: value of last observation

Postby EViews Gareth » Tue Jun 30, 2015 2:17 pm

Series.@last

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Re: value of last observation

Postby miorinnovo » Tue Jun 30, 2015 2:34 pm

I tried that but it gives me the date of the last observation, not the value.

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

Re: value of last observation

Postby EViews Gareth » Tue Jun 30, 2015 2:56 pm

@last(seriesname)

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Re: value of last observation

Postby miorinnovo » Tue Jun 30, 2015 3:18 pm

It says cannot assign numeric expression to string variable. The observations are dates, maybe that's the problem.

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

Re: value of last observation

Postby EViews Gareth » Tue Jun 30, 2015 3:21 pm

Sounds like you're trying to assign the value into a string, not a number.

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Re: value of last observation

Postby miorinnovo » Wed Jul 01, 2015 6:55 am

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?

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

Re: value of last observation

Postby EViews Gareth » Wed Jul 01, 2015 7:59 am

Grab the date as a number, the use @datestr to convert to a string that smpl will understand

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Re: value of last observation

Postby miorinnovo » Wed Jul 01, 2015 1:19 pm

Do you mean something like

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

That gives me an error saying its an illegal date.

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

Re: value of last observation

Postby EViews Gareth » Wed Jul 01, 2015 2:19 pm

Code: Select all

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

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Re: value of last observation

Postby miorinnovo » Wed Jul 01, 2015 3:03 pm

Thanks Gareth


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests