Hi, I have a variable for the day of the year and a variable for the hour of the day, such as:
The variable type of HOUR is double, while DAY is byte. I want to create a variable "Dummy" that takes the value of 1 if the observation happened after DAY 21 at 15:00 (I created the variable in the table above). I tried with the following code
but it says "15:00:00 invalid name". Does anyone know how to solve this?
Thank you very much!
| DAY | HOUR | Dummy |
| 21 | 13:51:08 | 0 |
| 21 | 14:32:01 | 0 |
| 21 | 17:45:48 | 1 |
| 22 | 10:12:16 | 1 |
| 22 | 13:15:01 | 1 |
gen dummy==0
replace dummy==1 if DAY > 21 & HOUR > 15:00:00?
replace dummy==1 if DAY > 21 & HOUR > 15:00:00?
Thank you very much!

Comment