Hi,
I have a dataset with 2 million observations that has 9000 dates string coded as 20010000 (year,month,date), and I would like to change the dates to 2001 07 01; and some are string coded 20050600 and I would like to change those dates to 2005 06 15.
I have been trying to extract the years separately from the month and day etc using :
gen year = substr (date ,1,2,3,4)
with the intent to use the replace comand and then join the year, month and date but I keep getting the r(198) message
I am using Stata 13.1
What is the correct way to do this?
Thanks in advance
I have a dataset with 2 million observations that has 9000 dates string coded as 20010000 (year,month,date), and I would like to change the dates to 2001 07 01; and some are string coded 20050600 and I would like to change those dates to 2005 06 15.
I have been trying to extract the years separately from the month and day etc using :
gen year = substr (date ,1,2,3,4)
with the intent to use the replace comand and then join the year, month and date but I keep getting the r(198) message
I am using Stata 13.1
What is the correct way to do this?
Thanks in advance
Comment