Page 1 of 1

Illegal date

Posted: Fri Mar 05, 2021 2:04 am
by nsea411
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!

Re: Illegal date

Posted: Fri Mar 05, 2021 8:00 am
by EViews Gareth
Can you provide the Excel file?

Re: Illegal date

Posted: Fri Mar 05, 2021 3:43 pm
by nsea411
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

Re: Illegal date

Posted: Fri Mar 05, 2021 8:24 pm
by EViews Gareth
You can only set a sample using dates if the workfile is dated.

Re: Illegal date

Posted: Sat Mar 06, 2021 6:39 am
by nsea411
Sorry Mr. Gareth, I don't quite understand what you mean. Could you please be more specific?
Thank you very much!

Re: Illegal date

Posted: Sat Mar 06, 2021 11:24 am
by EViews Gareth
Your excel file is not dated

Re: Illegal date

Posted: Sat Mar 06, 2021 11:32 am
by startz
The problem is that a bunch of your date series is missing values.