Good question. Within each group,
bysort group (beg) : gen disjoint = sum(beg != end[_n-1])
should divide into distinct groups of segments.
You then look for -duplicates- on -group- and -disjoint-.
Nick
[email protected]
Biernbaum, Lee
> Thanks for your help. I think this will definitely get me on the right
> track. One followup though:
>
> How do I ensure that the segments are, in fact, end-to-end?
> That is, it
> is not difficult to foresee a situation where
>
> Segment 1
> Beg = 1.00 end = 1.07
>
> Segment 2
> Beg = 1.07 end = 1.25
>
> Segment 9
> Beg = 2.97 end = 3.14
>
> And they match on all the other key variables (surface width, road id,
> etc). In this situation, Segments 3-8 may or may not exist in the
> database, but, even if they do, they do not match on the
> characteristics.
>
> In this case, Segments 1 and 2 should be combined but segment
> 3 left on
> its own.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/