My data has a date variable, and I want to extract year, month, date information from it:
date
03jun1960 00:00:00
06jun1960 00:00:00
07jun1960 00:00:00
08jun1960 00:00:00
09jun1960 00:00:00
10jun1960 00:00:00
13jun1960 00:00:00
So I use:
gen year = year(date)
But generate missing values only.
How to solve this?
0 Response to Stata extract year from date
Post a Comment