Dear statalist,

I have hourly panel data and want to generate an hour of a day for further analysis. From stata help file and other sources, I learn that the hh stata function does this.

But I did not get success.

To be precise, to get the months of the year, I use the following code, and went well.

Code:
gen month_num =month(mdy(month, day, year))
In the same procedure, I tried the following to get the hours

Code:
gen hour_num =hh(mdyhms(month, day, year, hour))
but in this case, the hour variable is without minutes and seconds. it is just hour 0......23.

But stata says invalid syntax.

Could anyone help me out, please?

Kindest regards,
Fissha