input str3(origin dest) str41 unique_carrier_name int departures_performed long passengers int year byte quarter
"ATL" "BNA" "Regions Air, Inc." 47 218 2005 1
"ATL" "BNA" "Regions Air, Inc." 47 292 2005 1
"ATL" "MIA" "American Airlines Inc." 165 13314 2005 1
"ATL" "ORD" "American Airlines Inc." 102 9202 2005 1
"ATL" "DFW" "American Airlines Inc." 319 29358 2005 1
I want to generate a new variable the Herfindahl–Hirschman Indices (HHI) — a conventional measure of market concentration, constructed as the sum of the squares of the market shares of all the firms on the market. Data is than the marketshare of an airline on a specific origin/dest pair route per quarter
However I do not have an OD pair in my dataset. How can I generate this? Thanks!
I think my following syntax looks like this:
Code:
#generate groups for route sort ODpair by ODpair: gen ODpairgroup = 1 if _n==1 replace ODpairgroup = sum(ODpairgroup) replace ODpairgroup =.if missing(ODpair) #generate HHI variable option2 gen MS2=(npaxtotal/paxroute)^2 sort ODpairgroup egen HHI=sum(MS2), by(ODpairgroup)
0 Response to Origin Dest Airline Data
Post a Comment