Hey, I have the following problem;

I have 2 datasets;
a panel dataset where the time variable is a monthly date (mdate) from 'Jan 2018' till 'Dec 2020';
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input long hh_id str16 state float(mdate month year) long total_income
10000111 "Uttar Pradesh" 696  1 2018 18170
10000111 "Uttar Pradesh" 697  2 2018 18180
10000111 "Uttar Pradesh" 698  3 2018 35000
10000111 "Uttar Pradesh" 699  4 2018 29000
10000111 "Uttar Pradesh" 700  5 2018 28000
10000111 "Uttar Pradesh" 701  6 2018 30000
10000111 "Uttar Pradesh" 702  7 2018 12285
10000111 "Uttar Pradesh" 703  8 2018 12285
10000111 "Uttar Pradesh" 704  9 2018 12285
10000111 "Uttar Pradesh" 705 10 2018 12285
10000111 "Uttar Pradesh" 710  3 2019 24230
10000111 "Uttar Pradesh" 711  4 2019 24225
10000111 "Uttar Pradesh" 712  5 2019 24245
10000111 "Uttar Pradesh" 713  6 2019 24235
10000111 "Uttar Pradesh" 714  7 2019 27150
10000111 "Uttar Pradesh" 715  8 2019 27152
10000111 "Uttar Pradesh" 716  9 2019 27150
10000111 "Uttar Pradesh" 717 10 2019 27155
10000111 "Uttar Pradesh" 718 11 2019 23645
10000111 "Uttar Pradesh" 719 12 2019 23655
10000111 "Uttar Pradesh" 720  1 2020 23645
10000111 "Uttar Pradesh" 721  2 2020 23655
10000111 "Uttar Pradesh" 726  7 2020 24250
10000111 "Uttar Pradesh" 727  8 2020 23250
10000111 "Uttar Pradesh" 728  9 2020 24250
10000111 "Uttar Pradesh" 729 10 2020 27250
10000111 "Uttar Pradesh" 730 11 2020 35155
10000111 "Uttar Pradesh" 731 12 2020 36945
10001060 "Maharashtra"   696  1 2018 13385
10001060 "Maharashtra"   697  2 2018 13775
10001060 "Maharashtra"   698  3 2018  4508
10001060 "Maharashtra"   699  4 2018 15500
10001060 "Maharashtra"   700  5 2018  5000
10001060 "Maharashtra"   701  6 2018 15000
10001060 "Maharashtra"   702  7 2018 19160
10001060 "Maharashtra"   703  8 2018 19160
10001060 "Maharashtra"   704  9 2018 19160
10001060 "Maharashtra"   705 10 2018 19160
10001060 "Maharashtra"   706 11 2018  8240
10001060 "Maharashtra"   707 12 2018 38700
end
format %tmMon_CCYY mdate
and a time series dataset starting in jan 1 2020 till dec 31 2020. I already made a monthly date variable (monthly_date) but when you browse it has values like '2020m1', while in the panel dataset above 'mdate' has value like 'Dec 2020'. I don't know if this is important to tell...

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str8 Date double(StringencyIndex StringencyIndexForDisplay StringencyLegacyIndexForDisplay) float(edatevar monthly_date)
"20200120"     0     0     0 21934 720
"20200121"     0     0     0 21935 720
"20200122"     0     0     0 21936 720
"20200123"     0     0     0 21937 720
"20200124"     0     0     0 21938 720
"20200125"  5.56  5.56  9.52 21939 720
"20200126" 10.19 10.19 16.67 21940 720
"20200127" 10.19 10.19 16.67 21941 720
"20200128" 10.19 10.19 16.67 21942 720
"20200129" 10.19 10.19 16.67 21943 720
"20200130" 10.19 10.19 16.67 21944 720
"20200131" 10.19 10.19 16.67 21945 720
"20200201" 10.19 10.19 16.67 21946 721
"20200202" 10.19 10.19 16.67 21947 721
"20200203" 10.19 10.19 16.67 21948 721
"20200204" 10.19 10.19 16.67 21949 721
"20200205" 10.19 10.19 16.67 21950 721
"20200206" 10.19 10.19 16.67 21951 721
"20200207" 10.19 10.19 16.67 21952 721
"20200208" 10.19 10.19 16.67 21953 721
end
format %td edatevar
format %tm monthly_date
So I want to merge the time series data into the panel dataset and the problem is that the value of, for instance, StringencyIndex changes on a daily base. So I want have the average of this variable for each month first so I can merge it.
So;
1. monthly average of double(StringencyIndex StringencyIndexForDisplay StringencyLegacyIndexForDisplay)
2. merge time series dataset to the panel dataset

I hope someone can help me. I already tried somethings but I don't get the result I need.
Thanks already for your time!