Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to create a variable for exposure to extreme weather events

    I have two datasets, one is on the number of extreme weather events, such as flood, drought, and heatwave, in different districts of a country from 1950 to 2014 with some missing years when no event took place (total 48 years). The other data set is on social and living standard measurement survey for 2006, 2008, 2012 and 2014. With these two data sets, I want to create a variable of how many extreme weather events a person has been exposed to throughout his/her lifetime. What I think is, this would be done by dividing total events in a district (from weather data) by the age of respondents (from survey data). For instance, if there were total 4 extreme events in a certain district from 1980 to 2010, then a person who was born in 1980, in 2010 at 30 years of age he/she has experienced 4 events, therefor the exposure is 4/30. The example of weather events dataset is given below and this data is on those districts where any event took place

    Code:
     clear
    *Data on extreme weather events
    input float year int distt_id str12 disaster_type
    1950 1 "Flood"
    1950 2 "Flood"
    1950 3 "Flood"
    1951 1 "Heatwave"
    1951 2 "Flood"
    1951 3 "Flood"
    1951 4 "Heatwave"
    1953 2 "Drought"
    1953 3 "Flood"
    1953 5 "Heatwave"
    2006 1 "Flood"
    2006 3 "Flood"
    2006 6 "Drought"
    2008 2 "Flood"
    2008 5 "Flood"
    2008 10 "Flood"
    2008 11 "Flood"
    2012 1 "Flood"
    2012 2 "Flood"
    2012 15 "Drought"
    2014 10 "Flood"
    2014 15 "Flood"
    2014 11 "Drought"
    end
    
    capture drop events
    gen events=0
    replace events=1 if inlist(disaster_type,"Flood","Heatwave","Drought")
    
    save "D:\Data\Thesis Data\weather data.dta", replace
    Following is the example of survey data and the code I used to merge this data with weather data. This dataset is available in almost all the districts in the country.

    Code:
    input float year int distt_id age *there are many other variables on demographics, income, and labor market
    
    2006 1 20
    2006 3 18
    2006 6 30
    2008 2 5
    2008 10 42
    2008 13 50
    2008 15 35
    2012 1 14
    2012 3 12
    2014 15 29
    2014 10 32
    2014 15 2
    2014 3 2
    end
    
    capture drop birth_cohort
    gen birth_cohort=year-age
    
    merge m:1 year distt_id using "D:\Data\Thesis Data\weather data.dta"
    
    bysort year distt_id birth_cohort:egen tot_events=sum(events)
    capture drop exposure
    gen exposure=tot_events/age
    
    save "D:\Data\Thesis Data\pslm.dta", replace
    After using the above-mentioned codes, the output I get is not something I require and I think that is because of no age information on weather data. I do not know whether I am going in the right direction or not? It would be great help if I can get any solution on how can i get this "exposure" variable.

    Many thanks in advance.
Working...
X