@now function?

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

Silvana
Posts: 13
Joined: Fri Jun 10, 2011 2:57 pm

@now function?

Postby Silvana » Wed Feb 06, 2013 5:06 pm

Eviews 6 user
I want to limit my sample to m 1994 2013 by using the @now function (or some other) so I can say smpl current year minus 20 years to current year

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

Re: @now function?

Postby EViews Gareth » Wed Feb 06, 2013 7:43 pm

I don't have EViews 6 on me, but in EViews 7, you can simply do:

Code: Select all

smpl @now-20 @now

I think it will work in EViews 6 too.
Follow us on Twitter @IHSEViews

Silvana
Posts: 13
Joined: Fri Jun 10, 2011 2:57 pm

Re: @now function?

Postby Silvana » Thu Feb 07, 2013 7:49 am

Thanks Gareth for the speedy response

Here's a snippet of my code

wfcreate(page=input) m 1992 2020

smpl @now-20 @now
(or maybe smpl @now-240 @now because it's monthly)

read(f128,s=upload core) etc.

Kicks off this Error Message--
Error in Sample: Illegal date @NOW in "SMPL @NOW-20 @NOW"

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

Re: @now function?

Postby EViews Gareth » Thu Feb 07, 2013 8:52 am

Seems that functionality wasn't in EViews 6. Have to do it the long way:

Code: Select all

wfcreate(page=input) m 1992 2020

%date1 = @datestr(@dateadd(@now,-20,"YY"),"YYYY-MM-DD")
%date2 = @datestr(@now, "YYYY-MM-DD")
smpl {%date1} {%date2}
Follow us on Twitter @IHSEViews


Return to “General Information and Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 9 guests