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.
Related Posts with Problem to create loop
Stata 17 ptrendsHi, I'm a student working on a diff in diff using Stata 17's new didregress. I used the postestimati…
Mean-adjusted change research designDear all, For my Master Thesis I am examining the change in institutional holdings after receiving …
Replace values in each rowHi, In the following dataset: Code: * Example generated by -dataex-. To install: ssc install data…
replicating an instrumented model in eregress and ivreg2 (or ivregress)Hi Stata people, I would like to replicate a model I am using in eregress (Stata 15 and up) with iv…
replicating an instrumented model in eregress and ivreg2 (or ivregress)Hi Stata people, I would like to replicate a model I am using in eregress (Stata 15 and up) and ivr…
Subscribe to:
Post Comments (Atom)
0 Response to Problem to create loop
Post a Comment