-
Notifications
You must be signed in to change notification settings - Fork 0
/
rain_fall.do
52 lines (30 loc) · 1.7 KB
/
rain_fall.do
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import delimited "C:\Users\AHema\OneDrive - CGIAR\Desktop\2024\WFP\Spatial climate data\sahel_rfh_20240618.csv", clear
drop v1
generate time2 = date(time, "YMD")
format %td time2
gen annee = year(time2)
gen mois = month(time2)
gen jour = day(time2)
gen ID = location + "_" + string(mois) + "_" + string(jour)
order time2 annee mois jour ID location
save "C:\Users\AHema\OneDrive - CGIAR\Desktop\2024\WFP\Spatial climate data\sahel_rfh_20240618.dta", replace
collapse (mean) rfh, by(ID)
rename rfh rfh_avg_all_hema
save "C:\Users\AHema\OneDrive - CGIAR\Desktop\2024\WFP\Spatial climate data\lta.dta", replace
use "C:\Users\AHema\OneDrive - CGIAR\Desktop\2024\WFP\Spatial climate data\sahel_rfh_20240618.dta", clear
merge m:1 ID using "C:\Users\AHema\OneDrive - CGIAR\Desktop\2024\WFP\Spatial climate data\lta.dta"
drop _merge
keep time time2 location rfh rfq rfh_avg_all_hema rfh_avg rfh_avg_all_hema annee mois jour ID
//sort location time
save "C:\Users\AHema\OneDrive - CGIAR\Desktop\2024\WFP\Spatial climate data\sahel_rfh_20240618.dta", replace
////////////////////////////////////////////////
keep if annee >=1989 & annee<=2018
collapse (mean) rfh, by(ID)
rename rfh rfh_avg_hema
save "C:\Users\AHema\OneDrive - CGIAR\Desktop\2024\WFP\Spatial climate data\lta.dta", replace
use "C:\Users\AHema\OneDrive - CGIAR\Desktop\2024\WFP\Spatial climate data\sahel_rfh_20240618.dta", clear
merge m:1 ID using "C:\Users\AHema\OneDrive - CGIAR\Desktop\2024\WFP\Spatial climate data\lta.dta"
drop _merge
keep time time2 location rfh rfq rfh_avg_hema rfh_avg_all_hema rfh_avg
sort location time
save "C:\Users\AHema\OneDrive - CGIAR\Desktop\2024\WFP\Spatial climate data\sahel_rfh_20240618.dta", replace