Hi STATA Experts,
I could not figure out why Stata changes minutes and seconds when I try to create a common datetime variable based on the existing datetime variables using some condition.
For example, I use this part of code to create a new variable <rand_datetime>
gen rand_datetime=randold_dt if rand_before11nov==1
replace rand_datetime=rand_dt if rand_before11nov !=1
format rand_datetime %tc
After running the above code for some records time (minutes and seconds do not natch with the original one)
Could someone shed a light on this problem?
I attached a screenshot of partial result and particular highlighted one as an example of discrepancy.
Thanks
I could not figure out why Stata changes minutes and seconds when I try to create a common datetime variable based on the existing datetime variables using some condition.
For example, I use this part of code to create a new variable <rand_datetime>
gen rand_datetime=randold_dt if rand_before11nov==1
replace rand_datetime=rand_dt if rand_before11nov !=1
format rand_datetime %tc
After running the above code for some records time (minutes and seconds do not natch with the original one)
Could someone shed a light on this problem?
I attached a screenshot of partial result and particular highlighted one as an example of discrepancy.
Thanks
Comment