Hello everybody,
I have a dataset containing tornado occurences in the USA.
h-geocode is the block -ID;
hit==1 if a tornado hit the block during the year;
treat =[egen treat=max(hit), by( h_geocode)];
treat_yr=[gen yr_tr=year // replace yr_tr=0 if hit==0// recode yr_tr 0=.];
multi_tr=[ by h_geocode: egen multi_tr=count( yr_tr)]
Hence multi_tr helps me identify wich blocks have been hit more than once. Now I would like to determine the distance (in year) between multiple occurences at the block level (h_geocode) in order to determine the best window for an eventy study analysis of the impact of tornado (hit==1) on my Y_var.
Can you suggest me the most effective way to calculate the distance between different treatment years (treat_yr)?
Thank you!
]
I have a dataset containing tornado occurences in the USA.
h-geocode is the block -ID;
hit==1 if a tornado hit the block during the year;
treat =[egen treat=max(hit), by( h_geocode)];
treat_yr=[gen yr_tr=year // replace yr_tr=0 if hit==0// recode yr_tr 0=.];
multi_tr=[ by h_geocode: egen multi_tr=count( yr_tr)]
Hence multi_tr helps me identify wich blocks have been hit more than once. Now I would like to determine the distance (in year) between multiple occurences at the block level (h_geocode) in order to determine the best window for an eventy study analysis of the impact of tornado (hit==1) on my Y_var.
Can you suggest me the most effective way to calculate the distance between different treatment years (treat_yr)?
Thank you!
]
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double h_geocode float(year hit Y_var treat yr_tr multi_tr) 10010201001000 2002 0 .8644371 0 . 0 10010201001000 2003 0 .8455727 0 . 0 10010201001000 2004 0 .8488644 0 . 0 10010201001000 2005 0 .853914 0 . 0 10010201001000 2006 0 .8604227 0 . 0 10010201001000 2007 0 .8604227 0 . 0 10010201001000 2008 0 .855893 0 . 0 10010201001000 2009 0 .8528046 0 . 0 10010201001000 2010 0 .8583788 0 . 0 10010201001000 2011 0 .8745581 0 . 0 10010201001000 2012 0 .8752647 0 . 0 10010201001000 2013 0 .8741398 0 . 0 10010201001000 2014 0 .8763138 0 . 0 10010201001000 2015 0 .8528046 0 . 0 10010201001000 2016 0 .855893 0 . 0 10010201001000 2017 0 .8549405 0 . 0 10010201001000 2018 0 .8455727 0 . 0 10010201001000 2019 0 .8088669 0 . 0 10010201001002 2002 0 .4812118 0 . 0 10010201001002 2003 0 0 0 . 0 10010201001002 2004 0 0 0 . 0 10010201001002 2005 0 0 0 . 0 10010201001002 2006 0 .6931472 0 . 0 10010201001002 2007 0 .6251451 0 . 0 10010201001002 2008 0 .4812118 0 . 0 10010201001002 2009 0 .4812118 0 . 0 10010201001002 2010 0 .4812118 0 . 0 10010201001003 2002 0 .8415393 0 . 0 10010201001003 2003 0 .8488644 0 . 0 10010201001003 2004 0 .8436636 0 . 0 10010201001003 2005 0 .8502933 0 . 0 10010201001003 2006 0 .859103 0 . 0 10010201001003 2007 0 .8436636 0 . 0 10010201001003 2008 0 .8549405 0 . 0 10010201001003 2009 0 .8472978 0 . 0 10010201001003 2010 0 .8472978 0 . 0 10010201001003 2011 0 .8317574 0 . 0 10010201001003 2012 0 .8549405 0 . 0 10010201001003 2013 0 .8549405 0 . 0 10010201001003 2014 0 .8516018 0 . 0 10010201001003 2015 0 .859103 0 . 0 10010201001003 2016 0 .859783 0 . 0 10010201001003 2017 0 .8610256 0 . 0 10010201001003 2018 0 .8502933 0 . 0 10010201001003 2019 0 .859103 0 . 0 10010201001005 2012 0 0 0 . 0 10010201001005 2015 0 0 0 . 0 10010201001005 2017 0 0 0 . 0 10010201001005 2018 0 0 0 . 0 10010201001007 2002 0 .7901687 0 . 0 10010201001007 2003 0 .7326683 0 . 0 10010201001007 2004 0 .8005853 0 . 0 10010201001007 2005 0 .8212039 0 . 0 10010201001007 2006 0 .7152214 0 . 0 10010201001007 2007 0 .7584862 0 . 0 10010201001007 2008 0 .8259218 0 . 0 10010201001007 2009 0 .8156089 0 . 0 10010201001007 2010 0 .7901687 0 . 0 10010201001007 2011 0 .6251451 0 . 0 10010201001007 2012 0 .8259218 0 . 0 10010201001007 2013 0 .5688249 0 . 0 10010201001007 2014 0 .7584862 0 . 0 10010201001007 2015 0 .8156089 0 . 0 10010201001007 2016 0 .7584862 0 . 0 10010201001007 2017 0 .8005853 0 . 0 10010201001007 2018 0 .8005853 0 . 0 10010201001007 2019 0 .8005853 0 . 0 10010201001008 2002 0 0 0 . 0 10010201001008 2004 0 0 0 . 0 10010201001008 2005 0 .4812118 0 . 0 10010201001008 2006 0 .6251451 0 . 0 10010201001008 2007 0 .4812118 0 . 0 10010201001008 2008 0 .6251451 0 . 0 10010201001008 2009 0 0 0 . 0 10010201001008 2010 0 .4812118 0 . 0 10010201001009 2003 0 0 0 . 0 10010201001009 2004 0 0 0 . 0 10010201001009 2010 0 0 0 . 0 10010201001009 2012 0 0 0 . 0 10010201001009 2014 0 0 0 . 0 10010201001009 2016 0 0 0 . 0 10010201001010 2006 0 0 0 . 0 10010201001010 2010 0 0 0 . 0 10010201001011 2003 0 0 0 . 0 10010201001011 2007 0 0 0 . 0 10010201001012 2002 0 .7766703 0 . 0 10010201001012 2003 0 .4812118 0 . 0 10010201001012 2004 0 .7766703 0 . 0 10010201001012 2005 0 .6251451 0 . 0 10010201001012 2006 0 .7326683 0 . 0 10010201001012 2007 0 .7326683 0 . 0 10010201001012 2008 0 .6931472 0 . 0 10010201001012 2009 0 .7584862 0 . 0 10010201001012 2010 0 .6251451 0 . 0 10010201001012 2014 0 0 0 . 0 10010201001012 2016 0 0 0 . 0 10010201001012 2017 0 0 0 . 0 10010201001012 2018 0 0 0 . 0 10010201001012 2019 0 0 0 . 0 10010201001013 2002 0 .8156089 0 . 0 end
Comment