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
Reshape multiple years observations from wide to longDear all, my current data structure is as follows: DATA CompanyID 2011 2012 2013 … 2019 VarOfIn…
How do I estimate a first order autoregressive equation with firm and year fixed effects ???I am really new to Stata and I need to estimate the following empirical specification on Stata for m…
9 Month back for date of birthHi, I have data on b1 (month of birth) and b2 (year of birth). I want to go back 9 (nine) months fro…
lclogit inquiryHi everyone, I'm new to Stata. I'm trying to classify individuals from which I have data in a series…
Store and export p values from pwcorr in a loopI am running correlations for ~3,000 variables. The nuance of the usefulness of p values versus conf…
Subscribe to:
Post Comments (Atom)
0 Response to event moment
Post a Comment