hi all,
I have the following question regarding creating a certain event moment. in this case, I'm interested when Southwest Airlines (WN) first started flying to or from Atlant (ATL). as can be seen in the data below, It uses ATL as a destination for the first time in time period 17, while it was a departure airport for the first time in time period 9.
for the lines with destination ATL i used the following command:
egen first_flight_dest=min(time), by(dest operating_carrier)
this gives me 17 for all the observations under ID 477.
for the second bold line, I use the command:
egen first_flight_origin=min(time), by(origin operating_carrier)
which gives me 9 for the observations under ID 1327.
clearly, time period 9 is the first moment WN starts flying to or from ATL. as said before, I'm interested in the period when southwest starts using ATL for the first time, so time period 9. but since I have over 300,000 observations, I don't want to check it all by hand. is there any command where no distinction is made between Atlanta as an origin or a destination airport? so that all the observations which include ATL as a departure or destination aerodrome show the time value of 9?
id year quarter time origin_id origin dest_id dest operating_carrier
477 2012 1 17 10257 "ALB" 10397 "ATL" "WN"
477 2012 2 18 10257 "ALB" 10397 "ATL" "WN"
477 2012 3 19 10257 "ALB" 10397 "ATL" "WN"
477 2012 4 20 10257 "ALB" 10397 "ATL" "WN"
477 2013 1 21 10257 "ALB" 10397 "ATL" "WN"
477 2013 2 22 10257 "ALB" 10397 "ATL" "WN"
477 2013 3 23 10257 "ALB" 10397 "ATL" "WN"
477 2013 4 24 10257 "ALB" 10397 "ATL" "WN"
477 2014 1 25 10257 "ALB" 10397 "ATL" "WN"
477 2014 2 26 10257 "ALB" 10397 "ATL" "WN"
477 2014 3 27 10257 "ALB" 10397 "ATL" "WN"
477 2014 4 28 10257 "ALB" 10397 "ATL" "WN"
477 2015 1 29 10257 "ALB" 10397 "ATL" "WN"
477 2015 2 30 10257 "ALB" 10397 "ATL" "WN"
477 2015 3 31 10257 "ALB" 10397 "ATL" "WN"
477 2015 4 32 10257 "ALB" 10397 "ATL" "WN"
477 2016 1 33 10257 "ALB" 10397 "ATL" "WN"
477 2016 2 34 10257 "ALB" 10397 "ATL" "WN"
477 2016 3 35 10257 "ALB" 10397 "ATL" "WN"
477 2016 4 36 10257 "ALB" 10397 "ATL" "WN"
477 2017 1 37 10257 "ALB" 10397 "ATL" "WN"
477 2017 2 38 10257 "ALB" 10397 "ATL" "WN"
477 2017 3 39 10257 "ALB" 10397 "ATL" "WN"
477 2017 4 40 10257 "ALB" 10397 "ATL" "WN"
477 2018 1 41 10257 "ALB" 10397 "ATL" "WN"
477 2018 2 42 10257 "ALB" 10397 "ATL" "WN"
477 2018 3 43 10257 "ALB" 10397 "ATL" "WN"
477 2018 4 44 10257 "ALB" 10397 "ATL" "WN"
477 2019 1 45 10257 "ALB" 10397 "ATL" "WN"
477 2019 2 46 10257 "ALB" 10397 "ATL" "WN"
477 2019 3 47 10257 "ALB" 10397 "ATL" "WN"
477 2019 4 48 10257 "ALB" 10397 "ATL" "WN"
1327 2010 1 9 10397 "ATL" 10529 "BDL" "WN"
1327 2012 2 18 10397 "ATL" 10529 "BDL" "WN"
1327 2012 3 19 10397 "ATL" 10529 "BDL" "WN"
1327 2012 4 20 10397 "ATL" 10529 "BDL" "WN"
1327 2013 1 21 10397 "ATL" 10529 "BDL" "WN"
1327 2013 2 22 10397 "ATL" 10529 "BDL" "WN"
1327 2013 3 23 10397 "ATL" 10529 "BDL" "WN"
1327 2013 4 24 10397 "ATL" 10529 "BDL" "WN"
1327 2014 1 25 10397 "ATL" 10529 "BDL" "WN"
1327 2014 2 26 10397 "ATL" 10529 "BDL" "WN"
1327 2014 3 27 10397 "ATL" 10529 "BDL" "WN"
1327 2014 4 28 10397 "ATL" 10529 "BDL" "WN"
1327 2015 1 29 10397 "ATL" 10529 "BDL" "WN"
1327 2015 2 30 10397 "ATL" 10529 "BDL" "WN"
1327 2015 3 31 10397 "ATL" 10529 "BDL" "WN"
1327 2015 4 32 10397 "ATL" 10529 "BDL" "WN"
1327 2016 1 33 10397 "ATL" 10529 "BDL" "WN"
1327 2016 2 34 10397 "ATL" 10529 "BDL" "WN"
1327 2016 3 35 10397 "ATL" 10529 "BDL" "WN"
1327 2016 4 36 10397 "ATL" 10529 "BDL" "WN"
1327 2017 1 37 10397 "ATL" 10529 "BDL" "WN"
1327 2017 2 38 10397 "ATL" 10529 "BDL" "WN"
1327 2017 3 39 10397 "ATL" 10529 "BDL" "WN"
1327 2017 4 40 10397 "ATL" 10529 "BDL" "WN"
1327 2018 1 41 10397 "ATL" 10529 "BDL" "WN"
1327 2018 2 42 10397 "ATL" 10529 "BDL" "WN"
1327 2018 3 43 10397 "ATL" 10529 "BDL" "WN"
kind regards,
Laurens
Related Posts with event moment
Shading between two lines in a graphDear Statalist, I'm trying to create a shaded area between the two borders of the confidence interv…
Quantile regressions-panel data, Pre-reqsHi Joao Santos Silva I am worried about two things in quantile regressions for panel data. 1. My d…
'' xthenreg'' for dynamic threshold modelsDear all it has been 8 months now since we got the new stata command for a dynamic threshold model …
Help on Generating a new variable that combines 2 variablesHi, I have the attached dataset which I have imported from Excel into Stata. I haven't made any ch…
Extracting the first number from a numeric variable into a new variableHi, I would like to extract the first number of another variable into a new variable. (And an addit…
Subscribe to:
Post Comments (Atom)
0 Response to event moment
Post a Comment