sample question - using series info

For questions regarding programming in the EViews programming language.

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

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

sample question - using series info

Postby miorinnovo » Wed Dec 12, 2018 10:03 am

Hi

If I want to have a sample of the last 6 months of my workbook I can use the code:
sample sample1 @last-6 @last

Is there a way to do this with the last date of a series rather than the last date in the workbook?

Thanks!

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

Re: sample question - using series info

Postby EViews Gareth » Wed Dec 12, 2018 10:22 am

Code: Select all

%lastdate = @otod(@ilast(y)-6)
smpl {%lastdate} @last

Where y is the series.
Follow us on Twitter @IHSEViews

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

Re: sample question - using series info

Postby miorinnovo » Wed Dec 12, 2018 11:49 am

Thanks Gareth.

I was looking to use the last date of the sample as the last date in my series. I was able to easily adjust your example to get that though, so for future readers looking how to do this:

Code: Select all

%lastdate = @otod(@ilast(CANADAALLSTARTS))
smpl  {%lastdate}-5  {%lastdate}


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

Re: sample question - using series info

Postby EViews Gareth » Wed Dec 12, 2018 11:51 am

That first line could be simplified as:

Code: Select all

%lastdate = CANADAALLSTARTS.@last
Follow us on Twitter @IHSEViews

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

Re: sample question - using series info

Postby miorinnovo » Wed Dec 12, 2018 12:05 pm

nice


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 21 guests