Hi,
I would like to create 3 time intervals with a dummy variable called "period":
period = 1: 12:00:00 and below
period = 2: 12:00:00 to 14:00:00
period = 3 :14:00:00 and above
I have a variable "date" that contains the date and time, properly entered in Stata. Here is an example:
date
03feb2015 15:33:30
Here is the code (or pseudo-code) that I have so far:
* Break down by intervals:
gen period = 1 if date < 10:00:00
replace period = 2 if missing(period) & date <= 12:00:00
replace period = 3 if missing(period) & date <= 14:00:00
replace period = 4 if missing(period) & date > 14:00:00
Anyone can help? Thanks a lot!
I would like to create 3 time intervals with a dummy variable called "period":
period = 1: 12:00:00 and below
period = 2: 12:00:00 to 14:00:00
period = 3 :14:00:00 and above
I have a variable "date" that contains the date and time, properly entered in Stata. Here is an example:
date
03feb2015 15:33:30
Here is the code (or pseudo-code) that I have so far:
* Break down by intervals:
gen period = 1 if date < 10:00:00
replace period = 2 if missing(period) & date <= 12:00:00
replace period = 3 if missing(period) & date <= 14:00:00
replace period = 4 if missing(period) & date > 14:00:00
Anyone can help? Thanks a lot!
Comment