Dear Users,

I have a question about "svy mean" to which I could not find a question yet on this forum; thus, I hope that you might help.

I am using a panel data set over years and countries. The data set also includes weights (pweights). I would like to compute the average weighted age per country per year. I need to save those average-weighted-ages as a variables, as I am later merging this variable to another data set.

An example:

Countr
Observation ID Country Year age weight Variabel I want
1 France 2000 10 1 30
2 France 2000 40 2 30
3 Germany 2000 20 4 25
4 Germany 2000 30 4 25
5 Germany 2001 40 2 40
6 Germany 2001 35 0 40
* The "Variable I want" is an estimate to give an impression of what I am seeking.

As far as I am concerned the following command gives me the computation I need
svyset [pweight = weight]
svy:mean age , over(country year)

However, this only gives me a table of the means. But I would need to match those means to the respective country-year combinations. To do this manually is almost impossible as I am considering around 300 of these country-year combinations.

I would be very thankful for an advice on how to do this!
Best
Silke