I want to plot the country averages of growth of GDP per capita and population for a panel data with the labels as well. I used the collapse (mean) to get the averages, but the country variable vanishes, making it difficult to use the mlabel option.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str3 country int year float(pairid Grgdppc Grpop) "AFG" 2016 1 .000518322 .02331066 "AFG" 2017 1 .04349136 .02350712 "AGO" 2016 2 -.02753639 .035899162 "AGO" 2017 2 -.036940575 .035440445 "ALB" 2016 3 .030433655 .003070831 "ALB" 2017 3 .034228325 .00308609 "ARG" 2016 4 -.032678604 .009432793 "ARG" 2017 4 .017119408 .009221077 "AUS" 2016 5 .010041237 .016744614 "AUS" 2017 5 .008573532 .01566124 "AUT" 2016 6 .003650665 .010813713 "AUT" 2017 6 .017516136 .006946564 "MLI" 2016 7 .026058197 .027124405 "MLI" 2017 7 .02194023 .027202606 "SAU" 2016 8 -.00551033 .02262497 "SAU" 2017 8 -.02751827 .020070076 "TUN" 2016 9 .0011749268 .011033058 "TUN" 2017 9 .008565903 .010432243 end
Code:
collapse (mean) Grgdppc Grpop , by(year )
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int year float(Grgdppc Grpop) 2016 .0006835196 .0177838 2017 .009664006 .016840829 end
Code:
graph twoway (lfitci Grgdppc Grpop) /// (scatter Grgdppc Grpop, mlabel(country) )
Thanking you in advance.
Best
David
0 Response to Ploting Panel data averages with labels
Post a Comment