Page 1 of 1

Problem using @first and @last in setting the sample

Posted: Wed Nov 27, 2019 5:02 am
by Sergio
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.

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

Posted: Wed Nov 27, 2019 7:49 am
by EViews Gareth
You’re referring to the documentation for the @last data member when using the @last function.

Try:

Code: Select all

=gdpyoy.@last

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

Posted: Wed Nov 27, 2019 7:56 am
by Sergio
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?

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

Posted: Wed Nov 27, 2019 8:23 am
by EViews Gareth
The documentation is correct.

Did you try what I suggested?

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

Posted: Wed Nov 27, 2019 8:28 am
by Sergio
It's my bad. The trick works nicely. It's just what I was looking for.
Thanks a lot.
S.