Dear statalist,
I have been trying to convert string dates but I got inconsistent results.
My data look like this:
Since I am only interested to the years, to destring Date I type:
However, what I got is:
As you see, I obtained strange results.
Thank you in advance for your support.
Best,
Stefano
I have been trying to convert string dates but I got inconsistent results.
My data look like this:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str10 Date "13jan2015" "24may1976" "12jun2012" "20mar1962" "07mar1877" "23dec1974" "17sep2014" "21dec1962" "05mar2008" "11nov2015" end
Code:
encode Date, generate(Date2) generate Date3=year(Date2)
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float Date3 1962 1964 1961 1963 1961 1963 1962 1963 1960 1961 end
Thank you in advance for your support.
Best,
Stefano
Comment