Hi
Working with irregular dated data - strings are "MM/dd?yyyyy"
Id like to etract "MM/YYYYY"
I have 60,000 observations - is there a function that will do the trick?
thanks
extacting portions of a string
Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13323
- Joined: Tue Sep 16, 2008 5:38 pm
Re: extacting portions of a string
You can do it easily with string manipulation:
You can also get a bit more clever and use the date functions:
Where you're using @dateval to convert your date strings into an EViews date, then you're using the @datestr function to convert it back into a string, but with the "MM/YYYY" format.
Code: Select all
alpha mydate = @left(date,3) + @right(date,4)
You can also get a bit more clever and use the date functions:
Code: Select all
alpha mydate = @datestr(@dateval(date,"MM/DD/YYYY"),"MM/YYYY")
Where you're using @dateval to convert your date strings into an EViews date, then you're using the @datestr function to convert it back into a string, but with the "MM/YYYY" format.
Follow us on Twitter @IHSEViews
Who is online
Users browsing this forum: No registered users and 27 guests