Hello all,
Below is the data I am using:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double(start end) byte ID
16071 16454 1
16455 16620 2
16819 17166 2
17167 17911 2
end
format %td start
format %td end
I want to group these observations based on whether the end date is one day before the next start date. If the end date is not one day before the next start date, then it is its own group. For example, the first two observations should be group 1 and the last two observations should be groups 2 and 3.
I would appreciate any help.
Anoush K.
0 Response to Grouping with a condition
Post a Comment