Silly date question

For questions regarding programming in the EViews programming language.

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

caburdick
Posts: 24
Joined: Mon Jun 15, 2009 7:41 am

Silly date question

Postby caburdick » Mon Aug 17, 2009 5:10 pm

I've been using replacement variables to define my estimation and solution samples for a VAR(2) model

%est_beg = 2000q4
%est_end = 2009q2

%slv_beg = 2001q2
%slv_end = 2015q4

smpl %est_beg %est_end

myvar.ls
makemodel commands etc

smpl %slv_beg %slv_end

solve the model commands

The two replacement variables %est_beg and %slv_beg are related by the lag lenght of the VAR

I would like to define a control variable

!varlen = 2

and then automatically determine

%slv_beg = %est_beg + !varlen

There is an example in the documentation showing something along the lines of

if !a>5 then
smpl 1950q1 1971q1+!a
endif

but this won't work with replacement variables.

I've been playing around with @dateval and @datediff etc, but haven't had any success. There has to be an easy way to do this, I just can't figure out what it is.

Any help will be greatly appreciated!

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

Re: Silly date question

Postby EViews Gareth » Tue Aug 18, 2009 9:03 am

The problem you're going to have is that dates are based on the frequency of the workfile, where as the number "2" isn't.

Probably the easiest thing to do is work with observation numbers rather than dates.

Usually if I'm writing a program where the sample is changing by a variable, I just write the sample as a function of @first and/or @last. Something like:

smpl @first+120+!varlen @first+150+!varlen
Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 42 guests