Hi,
How can I convert the following date format:
03/22/94
into a format similar to this:
13dec1982
Thanks
How can I convert the following date format:
03/22/94
into a format similar to this:
13dec1982
Thanks
help datetime
. di daily("03/22/94", "MDY", 2025) 12499 . di %td daily("03/22/94", "MDY", 2025) 22mar1994
help datetime_display_formats
* Example generated by -dataex-. To install: ssc install dataex clear input str8 var1 "02/04/94" "03/22/94" "05/17/94" "07/06/94" "08/16/94" "09/27/94" "11/15/94" "12/20/94" "02/01/95" "03/28/95" "05/23/95" "07/06/95" "08/22/95" "09/26/95" "11/15/95" "12/19/95" "01/31/96" "03/26/96" "05/21/96" "07/03/96" "08/20/96" "09/24/96" "11/13/96" "12/17/96" "02/05/97" "03/25/97" "05/20/97" "07/02/97" "08/19/97" "09/30/97" "11/12/97" "12/16/97" "02/04/98" "03/31/98" "05/19/98" "07/01/98" "08/18/98" "09/29/98" "11/17/98" "12/22/98" "02/03/99" "03/30/99" "05/18/99" "06/30/99" "08/24/99" "10/05/99" "11/16/99" "12/21/99" "02/02/00" "03/21/00" "05/16/00" "06/28/00" "08/22/00" "10/03/00" "11/15/00" "12/19/00" "01/03/01" "01/31/01" "03/20/01" "04/18/01" "05/15/01" "06/27/01" "08/21/01" "09/17/01" "10/02/01" "11/06/01" "12/11/01" "01/30/02" "03/19/02" "05/07/02" "06/26/02" "08/13/02" "09/24/02" "11/06/02" "12/10/02" "01/29/03" "03/18/03" "05/06/03" "06/25/03" "08/12/03" "09/16/03" "10/28/03" "12/09/03" "01/28/04" "03/16/04" "05/04/04" "06/30/04" "08/10/04" "09/21/04" "11/10/04" "12/14/04" "02/02/05" "03/22/05" "05/03/05" "06/30/05" "08/09/05" "09/20/05" "11/01/05" "12/13/05" "01/31/06" end
gen month = substr(var1, 1, 2) gen day = substr(var1, 4, 2) gen year = substr(var1, 7, 2) destring year month day, replace gen temp_year = real(year) replace temp_year = 2000 + temp_year if temp_year < 50 replace temp_year = 1900 + temp_year if temp_year >= 50 gen date = mdy(month, day, year) format date %td
gen wanted = daily(var1, "MDY", 2025) format wanted %td
quantile wanted
gen temp_year = real(year)
Comment