Page 1 of 1

sample using first and last of a series

Posted: Wed Mar 06, 2019 6:46 am
by miorinnovo
Hi,

I'd like to program a sample to start one month after the last observation of the series x, and end it one or two months later. I thought this would work

smpl @last(variablex) @last(variablex)+2

But it didnt work.

Can anyone offer another idea?

Thanks

Re: sample using first and last of a series

Posted: Wed Mar 06, 2019 8:43 am
by EViews Gareth
Store the dates in program variables first.

Code: Select all

%first = @ifirst(x)
smpl {%first}

Re: sample using first and last of a series

Posted: Wed Mar 06, 2019 1:56 pm
by miorinnovo
I tried

Code: Select all

%last= @last(x)
smpl {%last} {%last}+3


and get the message 'scalar assigned to a string'.

Re: sample using first and last of a series

Posted: Wed Mar 06, 2019 2:29 pm
by EViews Gareth
use @ilast and @ifirst

Re: sample using first and last of a series

Posted: Thu Mar 07, 2019 10:16 am
by miorinnovo
I tried

Code: Select all

%last= @ilast(variable)
smpl {%last} {%last}+3


and get the same error

Re: sample using first and last of a series

Posted: Thu Mar 07, 2019 10:27 am
by EViews Gareth
ha, been a while since I did this...

Code: Select all

%last = variable.@last
smpl {%last} {%last}+3

Re: sample using first and last of a series

Posted: Thu Mar 07, 2019 12:53 pm
by miorinnovo
Now I get the error:

%LAST is not defined or is an illegal command in "%LAST = variable.@LAST".

Re: sample using first and last of a series

Posted: Thu Mar 07, 2019 1:00 pm
by EViews Gareth
Which version of EViews?

Re: sample using first and last of a series

Posted: Thu Mar 07, 2019 1:57 pm
by miorinnovo
10+

Re: sample using first and last of a series

Posted: Thu Mar 07, 2019 2:35 pm
by EViews Matt
Hello,

Is the name of your series "variable" or "variablex"? That (unhelpful) error message can appear if you use a non-existent series name.

Re: sample using first and last of a series

Posted: Thu Mar 07, 2019 3:05 pm
by miorinnovo
Thank you! it was a typo in the variable name.

Re: sample using first and last of a series

Posted: Fri Mar 22, 2019 6:31 am
by miorinnovo
Hi again,

Is there a way to use the %last from

Code: Select all

 %last =variable.@last
as the date with the @elem function?

right now I have

Code: Select all

series Variabless=@elem(variable, "2018m12")


and i'd like to replace 2018m12 with something that will automatically take the last date of variable

Thanks!

Re: sample using first and last of a series

Posted: Fri Mar 22, 2019 7:05 am
by EViews Gareth

Code: Select all

series Variabless=@elem(variable, %last)

Re: sample using first and last of a series

Posted: Fri Mar 22, 2019 7:29 am
by miorinnovo
thanks