Code:
+--------------------------------------------+ | Year Greece Italy Portugal Spain | |--------------------------------------------| 1. | 2009 -4.301 -5.482 -2.978 -3.573 | 2. | 2010 -5.478 1.687 1.899 .015 | 3. | 2011 -9.132 .577 -1.827 -.997 | 4. | 2012 -7.3 -2.819 -4.028 -2.929 | 5. | 2013 -3.242 -1.728 -1.13 -1.706 | |--------------------------------------------| 6. | 2014 .74 .114 .893 1.379 | 7. | 2015 -.438 .924 1.822 3.65 | 8. | 2016 -.191 1.119 1.926 3.169 | 9. | 2017 1.505 1.597 2.795 2.983 | 10. | 2018 2.098 .881 2.08 2.529 | |--------------------------------------------| 11. | 2019 2.404 .087 1.677 2.131 | 12. | 2020 2.158 .909 1.5 1.875 | +--------------------------------------------+
# For each country, calculate averages by creating year group : 2009-2013, 2014-2018, 2019 and 2020. In this case, 2019 and 2020 do not need any calculation.
# Then generate a bar graph, where for each country there will be 4 bars.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str14 Year double(Greece Italy Portugal Spain) "2009" -4.301 -5.482 -2.978 -3.573 "2010" -5.478 1.687 1.899 .015 "2011" -9.132 .577 -1.827 -.997 "2012" -7.3 -2.819 -4.028 -2.929 "2013" -3.242 -1.728 -1.13 -1.706 "2014" .74 .114 .893 1.379 "2015" -.438 .924 1.822 3.65 "2016" -.191 1.119 1.926 3.169 "2017" 1.505 1.597 2.795 2.983 "2018" 2.098 .881 2.08 2.529 "2019" 2.404 .087 1.677 2.131 "2020" 2.158 .909 1.5 1.875 end
Comment