Hello all,

I have the dataset as follows.
In each observation I have carrier, time(yq), and market(from 1 to 2000).
For example in 2001q1(164), both UA and DL operate in market 1, in 2001q2(165) both UA and DL operate in market 1.
I was wondering how to generate a variable to indicate all the time-market combinations that both DL and UA operate in.

Maybe generate a dummy variable named "overlap". When overlap == 1, it means both DL and UA operate in that market in that quarter.

Any help is appreciated.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str6 carrier double yq float market
"DL" 160 1
"DL" 161 1
"DL" 162 1
"DL" 163 1
"UA" 163 1
"DL" 164 1
"UA" 164 1
"DL" 165 1
"UA" 165 1
"DL" 166 1
"DL" 167 1
"DL" 201 1
"DL" 202 1
"MQ" 204 1
"MQ" 205 1
"MQ" 206 1
"UA" 208 1
"DL" 217 1
"DL" 218 1
"DL" 219 1
"DL" 220 1
"DL" 221 1
"DL" 222 1
"DL" 223 1
"DL" 224 1
"DL" 225 1
"DL" 226 1
"DL" 227 1
"DL" 228 1
"DL" 229 1
end
format %tq yq