date conversion

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

antipa
Posts: 14
Joined: Tue Apr 16, 2013 9:47 am

date conversion

Postby antipa » Wed Dec 18, 2013 6:41 am

hello,

I would like to transform a series containing dates in numerical form (year*10000+month*100+day) into a date string. Also, is it possible to use this date string to then structure my workfile?

thanks a lot in advance

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: date conversion

Postby EViews Glenn » Wed Dec 18, 2013 11:40 am

From the docs
The @makedate function is used to translate ordinary numbers into date numbers. It is similar to @dateval but is designed for cases in which your dates are encoded in one or more numeric values instead of date strings:
...
@makedate(arg1[, arg2[,arg3]], fmt): takes the numeric values given by the arguments arg1, and optionally, arg2, etc. and returns a date number using the required format string, fmt.
...
Among the built-in formats is
“yymmdd” or “yyyymmdd”: year*10000 + month*100 + day in month.
So, if the coded dates are in the series A, then

Code: Select all

series date = @makedate(a, "yyyymmdd")
will create a date series that you can use to structure the workfile. You can use the @datestr function to create a string representation of the numbers in the date series, as in

Code: Select all

alpha datest = @datestr(date, "yyyy/mm/dd")
where you substitute whatever valid format you would like in the last argument.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests