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
Converting date/time
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
EViews Chris
- EViews Developer
- Posts: 161
- Joined: Wed Sep 17, 2008 10:39 am
Re: Converting date/time
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.
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.
Re: Converting date/time
Many thanks - that worked!
Re: Converting date/time
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
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
Who is online
Users browsing this forum: No registered users and 2 guests
