Hey,

I have the following dataset:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str7 gdp float qdate int År byte m1 str7 m3 int year byte Månad str9(m1_1 m3_1)
"142331" 80 1981 . "307 260" 1995  1 "" "721 919"
"144867" 81 1982 . "347 815" 1995  2 "" "704 519"
"143355" 82 1983 . "378 080" 1995  3 "" "710 330"
"163211" 83 1984 . "391 526" 1995  4 "" "704 512"
"156825" 84 1985 . "397 548" 1995  5 "" "698 161"
"163088" 85 1986 . "426 968" 1995  6 "" "710 766"
"154600" 86 1987 . "461 872" 1995  7 "" "704 145"
"174355" 87 1988 . "485 650" 1995  8 "" "710 639"
"169897" 88 1989 . "520 231" 1995  9 "" "720 939"
"180494" 89 1990 . "567 592" 1995 10 "" "721 069"
end
format %tq qdate
As you can see I have three different date variables,
I have merged three sets, one is ranging from 1980-2020 with quaterly data, one from 1981-1984 with yearly data, and the third from 1995-2020 with monthly data.
What I would like to do is to merge these together so I have annual observations from 1981-1994, and then quaterly observations from 1995-2020.
To do this I also need to generate annual means och "gdp" from 1981-1994 and then create quaterly means of "m1_1" and "m3_1" from 1995-2020.

/Nils