Hi all,
I have a dataset with this date variable, which is a string. It is a very weird variable, as the daily date is shown in two different formats: MMM D YYYY and DD-MMM-YY.
I would like to extract the monthly date from all observations of this variable, i.e. for both date formats.
I tried the very helpful code of Nick Cox in the following post: https://www.statalist.org/forums/for...rom-a-date-var and the user-written numdate command (from SSC), however I only got missing values generated.
Please could someone let me know how to extract a monthly date out of this variable?
Code:
input str11 startdate2 "Apr 1 1997" "Apr 1 1997" "Apr 1 1999" "Apr 1 1999" "Apr 1 1999" "Apr 1 2000" "Apr 1 2000" "Apr 1 2000" "Jul 1 2001" "Jul 1 2001" "Jul 1 2001" "Jul 1 2001" "Jul 1 2001" "Jun 1 2002" "Jun 1 2002" "Jun 1 2002" "Jun 1 2003" "23-Jun-10" "23-Jun-14" "23-May-11" "23-Nov-13" "23-Oct-14"
I would like to extract the monthly date from all observations of this variable, i.e. for both date formats.
I tried the very helpful code of Nick Cox in the following post: https://www.statalist.org/forums/for...rom-a-date-var and the user-written numdate command (from SSC), however I only got missing values generated.
Please could someone let me know how to extract a monthly date out of this variable?
Comment