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
Creating new yearsDear all, I have the following issue with my dataset. Every observation applies to multiple years (…
Multilevel SEM on Stata 15.1Hello everyone, I am trying to fit a multilevel SEM model in Stata 15.1, and it just won't converge…
Difference of regression coefficients?Hi, I have a regression : regress jobsatisfaction gender income d e f g h If I omit income (regress…
Filling in values for neighboring districtsHi all, I am trying to create a variable that reports the average level of an indicator (X) across …
dropped observations when running logitHi everyone, I'm running a logit which returns the following message: note: 65.city != 0 predicts s…
Subscribe to:
Post Comments (Atom)
0 Response to event moment
Post a Comment