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
Merging datasets by coordinates of objects and areasHey I have a question regarding the merging process when I do not have a key variable. My first data…
Merging with dates, ignoring missing values.Hello, I am trying to merge two datasets, one with stock price, so per company an observation per b…
marginal effects after gsemDear All, I'm estimating a gsem model with mlogit and probit equations with a nested structure (for …
Gen event variable for recurrent survival analysisHello everyone. I'm trying to create an event variable for my analysis. My objective is to gen a var…
Multilevel regression - problem lrtest and standard errorsHi all, I am currently working on my first project using STATA. I used mixed, trying to calculate a…
Subscribe to:
Post Comments (Atom)
0 Response to event moment
Post a Comment