Dear Stata users,
I have data for every hour on every day and it looks the following way:
01.01.1997 00:00
01.01.1997 01:00
....
Now I want to create a time variable that Stata recognizes to work with the data.
I know that the code
can be used to create a month and year variable but I do not know how to adjust the code to include day and hours.
I already looked at the help file but was still not able to get a solution.
Thank you very much in advance for your comment.
I have data for every hour on every day and it looks the following way:
01.01.1997 00:00
01.01.1997 01:00
....
Now I want to create a time variable that Stata recognizes to work with the data.
I know that the code
Code:
gen modate=ym(year,month) format modate %tm
I already looked at the help file but was still not able to get a solution.
Thank you very much in advance for your comment.
Comment