sample using first and last of a series
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
sample using first and last of a series
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
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
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13307
- Joined: Tue Sep 16, 2008 5:38 pm
Re: sample using first and last of a series
Store the dates in program variables first.
Code: Select all
%first = @ifirst(x)
smpl {%first}
Follow us on Twitter @IHSEViews
-
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
Re: sample using first and last of a series
I tried
and get the message 'scalar assigned to a string'.
Code: Select all
%last= @last(x)
smpl {%last} {%last}+3
and get the message 'scalar assigned to a string'.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13307
- Joined: Tue Sep 16, 2008 5:38 pm
-
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13307
- Joined: Tue Sep 16, 2008 5:38 pm
Re: sample using first and last of a series
Follow us on Twitter @IHSEViews
-
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
Re: sample using first and last of a series
Now I get the error:
%LAST is not defined or is an illegal command in "%LAST = variable.@LAST".
%LAST is not defined or is an illegal command in "%LAST = variable.@LAST".
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13307
- Joined: Tue Sep 16, 2008 5:38 pm
Re: sample using first and last of a series
Which version of EViews?
Follow us on Twitter @IHSEViews
-
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
-
- EViews Developer
- Posts: 560
- Joined: Thu Apr 25, 2013 7:48 pm
Re: sample using first and last of a series
Hello,
Is the name of your series "variable" or "variablex"? That (unhelpful) error message can appear if you use a non-existent series name.
Is the name of your series "variable" or "variablex"? That (unhelpful) error message can appear if you use a non-existent series name.
-
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
Re: sample using first and last of a series
Thank you! it was a typo in the variable name.
-
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
Re: sample using first and last of a series
Hi again,
Is there a way to use the %last from as the date with the @elem function?
right now I have
and i'd like to replace 2018m12 with something that will automatically take the last date of variable
Thanks!
Is there a way to use the %last from
Code: Select all
%last =variable.@last
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!
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13307
- Joined: Tue Sep 16, 2008 5:38 pm
Re: sample using first and last of a series
Code: Select all
series Variabless=@elem(variable, %last)
Follow us on Twitter @IHSEViews
-
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
Who is online
Users browsing this forum: No registered users and 27 guests