Converting date/time

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

Matt2222
Posts: 3
Joined: Tue Jan 12, 2010 7:16 am

Converting date/time

Postby Matt2222 » Tue Jan 12, 2010 7:24 am

Hi,

I have a time-series data set with 1-minute frequency data. The format of the timestamp is 20090630.2330 (i.e. yyyymmdd.hhmi). For some reason, I cannot tell Eviews to accept such a date/time format. Can anyone pls help?

Thx

EViews Chris
EViews Developer
Posts: 161
Joined: Wed Sep 17, 2008 10:39 am

Re: Converting date/time

Postby EViews Chris » Tue Jan 12, 2010 12:44 pm

If you've got the timestamp in a string or alpha series, then you can do the following:

series mydate = @dateval(datestring, "YYYYMMDD.HHMI")

where datestring is the string/alpha series containing the date

If you have it in a number, then you will have to first convert it to a string (with explicit trailing zeros) and then convert it as above:

series mydate = @dateval(@str(datenumber,"f.4"), "YYYYMMDD.HHMI")

where datenumber is the scalar/numeric series containing the date.

With most formats you can skip the middle step of converting to a string and use @makedate() to go straight from a number to an EViews date, but your format is outside the range of what @makedate() can understand.

You'll have to set the display format on the new series (mydate) to 'Day-Time' to see the results displayed as a human readable date.

Matt2222
Posts: 3
Joined: Tue Jan 12, 2010 7:16 am

Re: Converting date/time

Postby Matt2222 » Wed Jan 13, 2010 12:44 am

Many thanks - that worked!

Matt2222
Posts: 3
Joined: Tue Jan 12, 2010 7:16 am

Re: Converting date/time

Postby Matt2222 » Wed Jun 02, 2010 7:33 am

Hi,
I got another conversion question. I have the following date-time format: 20090701000002, i.e. "YYYYMMDDHHMISS", and I tried to use the following command in Eviews 6:
series mydate = @dateval(@str(time,"f.4"), "YYYYMMDDHHMISS") with time being my time variable
It only returned NaNs. Could you pls help? Thx


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests