Dear all
How can I extract the date, month and year from a date variable in STATA
Below is an example of my dataset
Thank you
How can I extract the date, month and year from a date variable in STATA
Below is an example of my dataset
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str10 Q2_9a "2018-05-07" "2011-03-07" "2018-10-15" "1900-06-01" "2018-01-01" "2014-05-13" "2014-10-23" "2017-05-16" "2018-01-01" "2014-05-12" "" "2018-01-01" "2014-05-14" "" "2013-10-03" "2016-10-27" "2008-04-03" "2014-05-13" "2015-12-24" "2017-09-14" "2012-05-07" "2014-07-09" "2011-03-01" "2016-09-01" "2018-01-01" "2018-05-04" "2014-08-01" "2010-10-11" "2018-05-07" "2018-04-16" "1993-04-27" "2015-05-07" "2012-04-16" "2018-05-14" "2018-05-11" "2016-05-07" "2015-08-04" "2005-11-01" "2017-10-06" "1900-06-01" "2017-06-12" "2011-05-25" "2015-05-07" "2014-12-10" "2014-10-23" "2016-12-02" "1900-06-01" "2008-01-10" "2005-08-31" "2005-05-17" "2006-12-31" "2010-10-12" "2000-10-16" "2011-07-01" "" "2005-06-01" "2016-01-19" "1900-06-01" "2016-05-19" "2015-05-07" "2015-05-07" "2008-06-30" "1998-07-07" "1985-01-04" "" "" "2004-03-23" "2008-06-30" "2018-02-05" "2014-12-04" "2014-08-19" "2003-10-15" "1999-07-24" "2015-05-07" "2015-05-29" "2015-05-05" "2015-05-05" "2014-06-20" "2015-05-05" "2001-12-21" "2009-09-09" "2015-08-05" "2018-03-19" "2017-02-13" "2011-07-15" "2018-03-19" "1985-01-01" "2007-01-01" "2015-05-04" "1900-06-01" "2015-01-13" "" "1981-01-01" "2015-05-06" "2017-03-31" "2017-05-01" "2015-11-04" "2016-01-01" "2015-06-25" "2016-08-25" end
Thank you
Comment