ssc install wbopendata help wbopendata ************************************************ wbopendata, country(GRC) clear keep if indicatorcode == "NY.GDP.PCAP.KD" keep indicatorcode yr* reshape long yr, i(indicatorcode) j(new) ren new year ren yr gdp twoway (connected gdp year, sort) tset year, yearly gen loggdp = log(gdp) gen growth = 100*(loggdp - L1.loggdp) twoway (connected growth year, sort) ************************************************* wbopendata, indicator(NY.GDP.PCAP.KD) clear keep countrycode countryname indicatorcode yr* reshape long yr, i(countrycode countryname indicatorcode) j(new) ren new year ren yr gdp encode countrycode, gen(ID) xtset ID year, yearly tab year tab countryname tab countryname if gdp!=. drop if gdp==. xtset ID year, yearly keep if countrycode == "GRC"|countrycode == "USA"|countrycode == "NLD"|countrycode == "AFG" tab countryname twoway (connected gdp year if countrycode=="GRC", sort) (connected gdp year if countrycode=="USA", sort) , legend(order(1 "GRC" 2 "USA")) twoway (connected gdp year if countrycode=="GRC", sort) (connected gdp year if countrycode=="USA", sort) (connected gdp year if countrycode=="NLD", sort), legend(order(1 "GRC" 2 "USA" 3 "NLD")) twoway (connected gdp year if countrycode=="GRC", sort) (connected gdp year if countrycode=="USA", sort) (connected gdp year if countrycode=="NLD", sort) (connected gdp year if countrycode=="AFG", sort), legend(order(1 "GRC" 2 "USA" 3 "NLD" 4 "AFG")) tw (connected gdp year if countrycode=="AFG", sort) gen loggdp = log(gdp) gen growth = 100*(loggdp - L1.loggdp) twoway (connected growth year if countrycode=="GRC", sort) (connected growth year if countrycode=="USA", sort) (connected growth year if countrycode=="NLD", sort) /*(connected growth year if countrycode=="AFG", sort)*/, legend(order(1 "GRC" 2 "USA" 3 "NLD" /*4 "AFG"*/)) xlabel(1960(2)2019, angle(45)) ylabel(-10(2)20, angle(0)) yline(0) keep if countrycode=="GRC"|countrycode=="USA" keep ID countrycode year gdp drop countrycode reshape wide gdp, i(year) j(ID) ren gdp88 gdpgr ren gdp250 gdpus gen loggdpgr = log(gdpgr) gen loggdpus = log(gdpus) tset year, yearly twoway (connected gdpgr year, sort) (connected gdpus year, sort) , legend(order(1 "GRC" 2 "USA")) reg loggdpgr loggdpus reg loggdpus loggdpgr tw (scatter loggdpgr loggdpus) (lfit loggdpgr loggdpus) corr loggdpgr loggdpus