Page 1 of 1

Inconsistent date handling

Posted: Wed Apr 11, 2012 11:39 pm
by paues
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?

Re: Inconsistent date handling

Posted: Thu Apr 12, 2012 7:49 am
by EViews Gareth
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.

Re: Inconsistent date handling

Posted: Fri Apr 13, 2012 12:20 am
by paues
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

Re: Inconsistent date handling

Posted: Fri Apr 13, 2012 6:50 am
by EViews Gareth
How would the wfcreate command know what "1" is?

Re: Inconsistent date handling

Posted: Fri Apr 13, 2012 7:31 am
by paues
Ah, I see your point. However, frequency is specified earlier on the very same line.

Do you have any input on my second issue?

Re: Inconsistent date handling

Posted: Fri Apr 13, 2012 8:03 am
by EViews Gareth
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.