Dear all,

It's a pleasure to exchange good ideas with you through the forum. It's really helpful!

Recently, I am trying to figure out two problems related to date and time using STATA 14.0MP. First, currently, all the hours in my dataset are shown as "1,2, ....24" since I used "reshape" to deal with them. And I want to replace 1 with 00:00:00, 24 with 23:00:00. I tried the "replace" but it doesn't work since it always hints me with "type mismatch". Second, I have another three columns showing the date data (year, month, day). I also want to generate a new variable and it looks like 2010-01-01 00:00:00. I tried "generate datetime=clock("Year-Month-Date Time", "YMD hms") but it still doesn't work.

If someone can help me with the two problems, I will be really grateful. Thank you in advance!

Best,

Mengrou