Inconsistent date handling

For questions regarding programming in the EViews programming language.

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

paues
Posts: 218
Joined: Fri Apr 15, 2011 7:16 am
Location: Stockholm, Sweden

Inconsistent date handling

Postby paues » Wed Apr 11, 2012 11:39 pm

EViews does not seem to handle dates in a consistent fashion. The following code works just fine. (Notice in particular the date manipulation on row 4.)

Code: Select all

%startdate="1970Q1" %enddate="2000Q4" wfcreate q %startdate %enddate smpl %startdate+1 %enddate
Whereas moving the date manipulation to line 3 causes the program to break down.

Code: Select all

%startdate="1970Q1" %enddate="2000Q4" wfcreate q %startdate+1 %enddate
The only way I can find to make the second code work is through the (quite lengthy) code below.

Code: Select all

%startdate="1970Q1" %enddate="2000Q4" %t=@datestr(@dateadd(@dateval(%startdate,"YYYY[Q]Q"),+1,"Q"),"YYYY[Q]Q") wfcreate q %t %enddate
Is there anyway less lengthy to do this? And are there intentions to make the date handling consistent?

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

Re: Inconsistent date handling

Postby EViews Gareth » Thu Apr 12, 2012 7:49 am

I'm not sure I understand the inconsistency. It isn't that dates are being handled differently, you're just doing two different things.

The way you are doing the second example seems the most efficient.

paues
Posts: 218
Joined: Fri Apr 15, 2011 7:16 am
Location: Stockholm, Sweden

Re: Inconsistent date handling

Postby paues » Fri Apr 13, 2012 12:20 am

Indeed you are correct that I am doing two different things. However, what I was aiming at was how the same date format, i.e. %startdate+1 (or "1970Q1"+1), is handled differently by the two commands smpl and wfcreate. When used in smpl it is understood and accepted, but in wfcreate it is not. To me, this seems an inconsistency.

Moreover, moving the date manipulation in the third code from my last post down to the wfcreate line also causes the program to break down.

Code: Select all

%startdate="1970Q1" %enddate="2000Q4" WfCreate q @datestr(@dateadd(@dateval(%startdate,"YYYY[Q]Q"),+1,"Q"),"YYYY[Q]Q") %enddate
IMHO there should not be any difference between how EViews handles a variable which has been declared to contain a value and how EViews handles that same value if entered directly.

One small consolation is that this odd behavior at least seems to be consistent. Replacing %startdate+1 in the second code from my last post with @datestr(@dateadd(@dateval(%startdate,"YYYY[Q]Q"),+1,"Q"),"YYYY[Q]Q"), as per the code below, also causes the program to break down.

Code: Select all

%startdate="1970Q1" %enddate="2000Q4" wfcreate q %startdate %enddate smpl @datestr(@dateadd(@dateval(%startdate,"YYYY[Q]Q"),+1,"Q"),"YYYY[Q]Q") %enddate

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

Re: Inconsistent date handling

Postby EViews Gareth » Fri Apr 13, 2012 6:50 am

How would the wfcreate command know what "1" is?

paues
Posts: 218
Joined: Fri Apr 15, 2011 7:16 am
Location: Stockholm, Sweden

Re: Inconsistent date handling

Postby paues » Fri Apr 13, 2012 7:31 am

Ah, I see your point. However, frequency is specified earlier on the very same line.

Do you have any input on my second issue?

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

Re: Inconsistent date handling

Postby EViews Gareth » Fri Apr 13, 2012 8:03 am

Neither the WFCREATE command nor the SMPL command take strings as arguments (the fact that you can enclose the arguments in quotes if you want does not mean that they actually take strings as arguments). Thus you cannot use functions that return strings as arguments.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests