Hello. I am a new Eviews 7 user although I have used previous versions before at the University.
I have a question about importing dates data from an excel spreadsheet. The thing is that I created an unstructured workfile with different pages and then I want one of the series to be read from excel to be the date id for structuring the page I will be using.
When I did this, the excel sheet had date formats as "1/2/98" ("month/day/year"), and Eviews assigns each of these dates a number. However, when I try to change this format to an alpha series, it does not match the date between the Excel and Eviews. For example, in excel, the number 35797 corresponds to 1/2/98 (month/day/year), and when I use in Eviews the command @datestr(35797, "mm/dd/yyyy"), it throws 1/4/99 (month/day/year).
Do you know if there is any way to solve this? I know it can be done by a little programming, but I was thinking there is a more intelligent way to "tell" Eviews the format date I am importing from excel.
Thanks a lot.
Regards.
Importing date from excel spreadsheet
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Importing date from excel spreadsheet
If you're just importing the Excel sheet into a page, EViews should automatically recognise them as being Excel dates and do the conversion for you.
How are you doing the import?
How are you doing the import?
Re: Importing date from excel spreadsheet
Hello, thank you very much for your quick answer. I am doing the following:
1) Workfile creation (unstructured):
wfcreate(wf=VAR, page=Inflation) u 2522
(I have 2522 data on the page)
2) Read from Excel
read(a2, s=UF) "C:\Documents and Settings\.....\VAR Micro.xls" 2
(Where in the "a" column in excel dates are stored)
3) Srtucturing the page according to the date
pagestruct @date(date)
With these commands the page is structured with the date numbers, not strings (as "1/4/98" for example). And when I try to change number to string dates by using genr date_str=@datestr(date, "mm/dd/yy") it doesn´t work for the series. Even more, in excel the number 35797 corresponds to the date "1/2/98" in format "mm/dd/yy", however, when using in Eviews (for example) the command genr date_string = @datestr(35797, "mm/dd/yyyy") it throws "1/4/99" in format "mm/dd/yy", so I was thinking the formats don´t match, but maybe I am doing something wrong, I am not sure.
Thank you very much!
Regards
1) Workfile creation (unstructured):
wfcreate(wf=VAR, page=Inflation) u 2522
(I have 2522 data on the page)
2) Read from Excel
read(a2, s=UF) "C:\Documents and Settings\.....\VAR Micro.xls" 2
(Where in the "a" column in excel dates are stored)
3) Srtucturing the page according to the date
pagestruct @date(date)
With these commands the page is structured with the date numbers, not strings (as "1/4/98" for example). And when I try to change number to string dates by using genr date_str=@datestr(date, "mm/dd/yy") it doesn´t work for the series. Even more, in excel the number 35797 corresponds to the date "1/2/98" in format "mm/dd/yy", however, when using in Eviews (for example) the command genr date_string = @datestr(35797, "mm/dd/yyyy") it throws "1/4/99" in format "mm/dd/yy", so I was thinking the formats don´t match, but maybe I am doing something wrong, I am not sure.
Thank you very much!
Regards
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Importing date from excel spreadsheet
You're probably better off either just opening the Excel file:
Or creating the workfile and then importing the file:
Code: Select all
wfopen "C:\Documents and Settings\.....\VAR Micro.xls" Range="uf"
Code: Select all
wfcreate(wf=VAR, page=inflation) u 2522
import "C:\Documents and Settings\.....\VAR Micro.xls" Range="uf"
Re: Importing date from excel spreadsheet
hahaha It worked perfectly.
Thank you so much.
Regards.
Thank you so much.
Regards.
Who is online
Users browsing this forum: No registered users and 1 guest
