Hi everybody,
I am having a small coding problem that I cannot figure out.
I have elapsed two variables into one, in order to display them in a time format.
Now, I would like to recode some initially missing values to 999, to indicate that they are missing due to the questionaire's skip pattern.
Naturally, since I have used a format command, Stata turns the 999 into a time format as well, though: 999 is displayed as 00:00.
Is there any way in which the variable is generally being displayed in the HH:MM time format, but only in the case of 999 it is being displayed as it is?
My code is the following:
gen interviewtime = hms(A1A, A1B, 0)
format interviewtime %tcHH:MM
replace interviewtime=999 if Z1==0
Any help would be very much appreciated!
Best,
Maja
I am having a small coding problem that I cannot figure out.
I have elapsed two variables into one, in order to display them in a time format.
Now, I would like to recode some initially missing values to 999, to indicate that they are missing due to the questionaire's skip pattern.
Naturally, since I have used a format command, Stata turns the 999 into a time format as well, though: 999 is displayed as 00:00.
Is there any way in which the variable is generally being displayed in the HH:MM time format, but only in the case of 999 it is being displayed as it is?
My code is the following:
gen interviewtime = hms(A1A, A1B, 0)
format interviewtime %tcHH:MM
replace interviewtime=999 if Z1==0
Any help would be very much appreciated!
Best,
Maja
Comment