Goodmorning
I have a panel data, with severall variables for each countriesin every years. However I have some missing values so I may want to subsitute them with the value of the mean (for each variables, and countries). Without using the loop the command would be
1)bysort countryname: egen AvgGDP=mean(GDP).
2)replace GDP=AvgGDP if GDP==.
My question is: is possible to automate this process using a loop?
I hope I was clear.
Thank you for your attention.