Problem using @first and @last in setting the sample

For questions regarding programming in the EViews programming language.

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

Sergio
Posts: 12
Joined: Tue May 19, 2015 1:32 am

Problem using @first and @last in setting the sample

Postby Sergio » Wed Nov 27, 2019 5:02 am

Hi there,
I have a problem using the function @first and @last.
Here is what I expected to get from these operators, it is an excerpt from the eviews guide:
Series Data Members
String values

@first string containing the date or observation number of the first non-NA observation of the series. In a panel workfile, the first date at which any cross-section has a non-NA observation is returned.

@last string containing the date or observation number of the last non-NA observation of the series. In a panel workfile, the last date at which any cross-section has a non-NA observation is returned.
Instead if I write for instance
string gdpend=@last(gdpyoy)
I get a message error that the output of this operator is a SCALAR and NOT a STRING.
I hoped that it was the OBSERVATION NUMBER, I was wrong it simply showed the VALUE of (in this case) the last non-NA observation of the series.

I'm trying to build a program that set the workfile range equal to the time interval spanned by a specific serie (in the example above the gdpyoy).
Could some one help me?
thanks a lot
S.

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

Re: Problem using @first and @last in setting the sample

Postby EViews Gareth » Wed Nov 27, 2019 7:49 am

You’re referring to the documentation for the @last data member when using the @last function.

Try:

Code: Select all

=gdpyoy.@last

Sergio
Posts: 12
Joined: Tue May 19, 2015 1:32 am

Re: Problem using @first and @last in setting the sample

Postby Sergio » Wed Nov 27, 2019 7:56 am

It is correct but the guide gives wrong informations regarding the output of the operator.
My aim here is to set the sample equal to the time interval spanned by a specific series.
is there any function that does the trick?

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

Re: Problem using @first and @last in setting the sample

Postby EViews Gareth » Wed Nov 27, 2019 8:23 am

The documentation is correct.

Did you try what I suggested?

Sergio
Posts: 12
Joined: Tue May 19, 2015 1:32 am

Re: Problem using @first and @last in setting the sample

Postby Sergio » Wed Nov 27, 2019 8:28 am

It's my bad. The trick works nicely. It's just what I was looking for.
Thanks a lot.
S.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests