贴一个关于world bank数据应用的方法。stata还是很强大的呃~
这问题的来源是因为……今天用人人上原帖的方法贴到stata里面试了一下,结果报错……不知道是因为stata11访问方法不一致咩……下面是解决方法:
1、下载world_adm0.zip,然后在stata的根目录下解压缩(google一下有免费的下载)
2、ssc install spmap
3、ssc install shp2dta
4、shp2dta using world_adm0, data(world-d) coor(world-c) genid(id)
5、安装世界银行的模块:ssc install wbopendata
6、导入需要的topic或者indicator:db wbopendata
数据描述: 世界银行数据, 好像按照topic导入要花很久时间Orz……可以试着按indicator 导吧……
7、数据处理
save world_economic_indicator, replace
sysuse world_economic_indicator, clear
keep if indicatorname=="Trade in services (% of GDP)" //选用贸易指标
sort countrycode //做merge一定记得要sort!!!
save trade, replace
sysuse world-d, clear
rename GMI_CNTRY countrycode //人人上没有这一步,我不知道他的world_adm0.zip在哪里下的直接有countrycode?……欢迎交流……
sort countrycode
merge countrycode using trade
drop if missing(id) //扔掉缺失值,因为似乎world-d里面没有这么多的地区……
8、画图
spmap yr2010 using "world-c.dta", id(id) ///
clnumber(20) fcolor(Reds2) ocolor(none ..) ///
title("Trade in services (% of GDP)", size(*1.2)) ///
legstyle(3) legend(ring(1) position(3)) ///
note("Source: World Development Indicators (latest available year: 2010)") //再次表示renren里note 这一部分貌似语法也有问题啊……
最后就是这样子啦,关于颜色什么的自己看help spmap吧……还有我也不知道为啥这么多地区missing了……


雷达卡






京公网安备 11010802022788号







