Hello everyone,
I have a dataset covering natural disasters in the US for each county from 1994. I want to create a dummy variable if a certain type of hazard say "Flooding" hit a certain county in a certain year. However, I want to exclude counties which were hit in a certain year if there was a similar hazard in previous 3 years. Just to give an example: if county Talbot gets hit twice in a window of 3 years, I want the dummy to take value of 1 only for the first event, but not for the second. Below an example from my data set.
Thank you in advance!
input str20 state int Year str20 county long fips str26 Hazard byte Quarter
"GEORGIA" 1994 "Randolph" 13243 "Flooding" 3
"GEORGIA" 1994 "Rockdale" 13247 "Flooding" 3
"GEORGIA" 1994 "Schley" 13249 "Flooding" 3
"GEORGIA" 1998 "Seminole" 13253 "Flooding" 1
"GEORGIA" 1994 "Spalding" 13255 "Flooding" 3
"GEORGIA" 1998 "Spalding" 13255 "Flooding" 1
"GEORGIA" 2004 "Spalding" 13255 "Flooding" 3
"GEORGIA" 2004 "Stephens" 13257 "Flooding" 3
"GEORGIA" 2009 "Stephens" 13257 "Flooding" 3
"GEORGIA" 1994 "Stewart" 13259 "Flooding" 3
"GEORGIA" 1994 "Sumter" 13261 "Flooding" 3
"GEORGIA" 1998 "Sumter" 13261 "Flooding" 1
"GEORGIA" 1994 "Talbot" 13263 "Flooding" 3
"GEORGIA" 1998 "Talbot" 13263 "Flooding" 1
"GEORGIA" 1994 "Taylor" 13269 "Flooding" 3
"GEORGIA" 1998 "Telfair" 13271 "Flooding" 1
"GEORGIA" 2004 "Telfair" 13271 "Flooding" 3
"GEORGIA" 2009 "Telfair" 13271 "Flooding" 2
"GEORGIA" 1994 "Terrell" 13273 "Flooding" 3
"GEORGIA" 1998 "Terrell" 13273 "Flooding" 1
"GEORGIA" 1994 "Thomas" 13275 "Flooding" 4
"GEORGIA" 1998 "Thomas" 13275 "Flooding" 1
"GEORGIA" 1994 "Tift" 13277 "Flooding" 4
"GEORGIA" 2004 "Toombs" 13279 "Flooding" 3
"GEORGIA" 2009 "Toombs" 13279 "Flooding" 2
"GEORGIA" 2004 "Towns" 13281 "Flooding" 3
"GEORGIA" 1998 "Treutlen" 13283 "Flooding" 1
"GEORGIA" 2004 "Treutlen" 13283 "Flooding" 3
"GEORGIA" 1994 "Troup" 13285 "Flooding" 3
"GEORGIA" 2015 "Troup" 13285 "Flooding" 4
"GEORGIA" 1994 "Twiggs" 13289 "Flooding" 3
Related Posts with Create a dummy for windows of observations
midas: Hessian has become unstable or asymmetric r(504);I have one more query on midas please. While doing analysis, an error statement came up as below Hes…
Matching based on market value with range.Hi, I am trying to Match the companies in my dataset that belong to the test sample 1:1 to a compan…
Generating ID variables in one data set based on some observations in another data setHI all, Please consider the following data set: data set_1 clear . input str8 respid byte str…
Tracking changes in datasetHi, I tracked executives across firms and retained those executives who were employed for at least …
A stochastic frontier model with correction for sample selection in StataDear Statalist, I am trying to estimate a SFM that can address selection bias. Theoretically, I am …
Subscribe to:
Post Comments (Atom)
0 Response to Create a dummy for windows of observations
Post a Comment