Illegal date

For questions regarding programming in the EViews programming language.

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

nsea411
Posts: 9
Joined: Wed Jan 20, 2021 9:02 am

Illegal date

Postby nsea411 » Fri Mar 05, 2021 2:04 am

Dear friends,

I encountered a problem when I tried to run a program( I wrote this code because I want to cut a whole time series into several samples according to the date, for example, the data from 2001/1/1-2001/1/31 is a sample, the data from 2001/2/1-2001/2/28 is another sample, and then do regressions within each sample).

Code: Select all

  wfopen C:\Users\dell\Desktop\agriculture.xlsx

for !i= 1 to 12
for !j=2001 to 2019

smpl {!j}m{!i} {!j}m{!i}
genr a{!j}{!i} =ri
genr b{!j}{!i} =roil
genr c{!j}{!i} =rm
genr d{!j}{!i} =smb
genr e{!j}{!i} =hml

matrix(5,(!i-1)*19+!j-2000) coefs

equation eq{!j}{!i}.ls a{!j}{!i} c b{!j}{!i} c{!j}{!i} d{!j}{!i} e{!j}{!i}

colplace(coefs, eq{!j}{!i}.@coefs,(!i-1)*19+!j-2000)
next
next


When I run this code, Eviews gave me the notice: Error in Sample: Illegal date 1/1/2001 in "SMPL 2001M1 2001M1".
I wonder what goes wrong :cry: .
If I can get your help, I will be very happy. Thank you in advance!

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

Re: Illegal date

Postby EViews Gareth » Fri Mar 05, 2021 8:00 am

Can you provide the Excel file?
Follow us on Twitter @IHSEViews

nsea411
Posts: 9
Joined: Wed Jan 20, 2021 9:02 am

Re: Illegal date

Postby nsea411 » Fri Mar 05, 2021 3:43 pm

Dear Gareth,
I have posted two Excel files, agriculture data are calculated by the previous code. When I tried to run it again, the code works, but when I wanted to run a similar code(attached below) to calculate coal data, the same Eviews notice came out again. I'm using Eviews 10(I'm sorry I forgot to mention it before).
Thank you for your help!

Code: Select all

wfopen C:\Users\dell\Desktop\coal.xlsx

for !i= 1 to 12
for !j=2003 to 2020

smpl {!j}m{!i} {!j}m{!i}

genr a{!j}{!i} =ri
genr b{!j}{!i} =roil
genr c{!j}{!i} =rmrf
genr d{!j}{!i} =smb
genr e{!j}{!i} =hml

matrix(5,(!i-1)*18+!j-2000) coefs

equation eq{!j}{!i}.ls a{!j}{!i} c b{!j}{!i} c{!j}{!i} d{!j}{!i} e{!j}{!i}

colplace(coefs, eq{!j}{!i}.@coefs,(!i-1)*18+!j-2000)
next
next
Attachments
agriculture.xlsx
(415.86 KiB) Downloaded 201 times
coal.xlsx
(389.3 KiB) Downloaded 205 times

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

Re: Illegal date

Postby EViews Gareth » Fri Mar 05, 2021 8:24 pm

You can only set a sample using dates if the workfile is dated.
Follow us on Twitter @IHSEViews

nsea411
Posts: 9
Joined: Wed Jan 20, 2021 9:02 am

Re: Illegal date

Postby nsea411 » Sat Mar 06, 2021 6:39 am

Sorry Mr. Gareth, I don't quite understand what you mean. Could you please be more specific?
Thank you very much!

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

Re: Illegal date

Postby EViews Gareth » Sat Mar 06, 2021 11:24 am

Your excel file is not dated
Follow us on Twitter @IHSEViews

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Illegal date

Postby startz » Sat Mar 06, 2021 11:32 am

The problem is that a bunch of your date series is missing values.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 34 guests