2012年10月份的数据库
数据源:
http://www.imf.org/external/pubs/ft/weo/2012/02/weodata/download.aspx
引用请注明出处:October 2012 WEO Database
附件
WEOupdate.zip
(4.32 MB, 需要: 2 个论坛币)
本附件包括:- WEOOct2012alla.xls
- weom.csv
- weooct2012.dta
- WEOOct2012all.xls
(参照sungmoo的标签解法,为便于交流,do-file源码贴到尾部,大家看看有什么更快捷的办法)
以下是变量描述(Stata限定变量标签不得超出80个字符
):| variable name | variable label |
| country | Country |
| iso | ISO |
| estyr | Estimates Start After |
| year | |
| BCA_NGDPD | current account balance;percent of gdp; |
| BCA | current account balance;u.s. dollars;billions |
| LE | employment;persons;millions |
| GGXWDG | general government gross debt;national currency;billions |
| GGXWDG_NGDP | general government gross debt;percent of gdp; |
| GGXWDN | general government net debt;national currency;billions |
| GGXWDN_NGDP | general government net debt;percent of gdp; |
| GGXCNL | general government net lending/borrowing;national currency;billions |
| GGXCNL_NGDP | general government net lending/borrowing;percent of gdp; |
| GGXONLB | general government primary net lending/borrowing;national |
| currency;billions | |
| GGXONLB_NGDP | general government primary net lending/borrowing;percent of gdp; |
| GGR | general government revenue;national currency;billions |
| GGR_NGDP | general government revenue;percent of gdp; |
| GGSB | general government structural balance;national currency;billions |
| GGSB_NPGDP | general government structural balance;percent of potential gdp; |
| GGX | general government total expenditure;national currency;billions |
| GGX_NGDP | general government total expenditure;percent of gdp; |
| PPPPC | gross domestic product based on purchasing-power-parity (ppp) per capita |
| gdp;cur | |
| PPPSH | gross domestic product based on purchasing-power-parity (ppp) share of |
| world tot | |
| PPPGDP | gross domestic product based on purchasing-power-parity (ppp) valuation |
| of count | |
| NGDP_FY | gross domestic product corresponding to fiscal year, current |
| prices;national cur | |
| NGDPRPC | gross domestic product per capita, constant prices;national |
| currency;units | |
| NGDPPC | gross domestic product per capita, current prices;national currency;units |
| NGDPDPC | gross domestic product per capita, current prices;u.s. dollars;units |
| NGDP_R | gross domestic product, constant prices;national currency;billions |
| NGDP_RPCH | gross domestic product, constant prices;percent change; |
| NGDP | gross domestic product, current prices;national currency;billions |
| NGDPD | gross domestic product, current prices;u.s. dollars;billions |
| NGDP_D | gross domestic product, deflator;index; |
| NGSD_NGDP | gross national savings;percent of gdp; |
| PPPEX | implied ppp conversion rate;national currency per current international |
| dollar; | |
| PCPI | inflation, average consumer prices;index; |
| PCPIPCH | inflation, average consumer prices;percent change; |
| PCPIE | inflation, end of period consumer prices;index; |
| PCPIEPCH | inflation, end of period consumer prices;percent change; |
| NGAP_NPGDP | output gap in percent of potential gdp;percent of potential gdp; |
| LP | population;persons;millions |
| FLIBOR6 | six-month london interbank offered rate (libor);percent; |
| NID_NGDP | total investment;percent of gdp; |
| LUR | unemployment rate;percent of total labor force; |
| TXGO | value of oil exports;u.s. dollars;billions |
| TMGO | value of oil imports;u.s. dollars;billions |
| TX_RPCH | volume of exports of goods and services;percent change; |
| TXG_RPCH | volume of exports of goods;percent change; |
| TM_RPCH | volume of imports of goods and services;percent change; |
| TMG_RPCH | volume of imports of goods;percent change; |
开源数据,一起分享
*weom.csv消掉了源数据库里的n/a和--insheet using weom.csv, names clearinsheet using weom.csv, names clear
foreach i of numlist 10/47 {
local j=`i'+1970
rename v`i' y`j'
}
save weo,replace
rename weosubjectcode varcode
rename subjectdescri~r var
rename weocountrycode countrycode
rename estimatesstar~r estyr
egen varm=concat(var units scale), p(;)
replace varm=strlower(varm)
drop var countrycode subjectnotes units scale countryseriesspecificnotes
order country iso varcode varm estyr
rename varcode var
rename varm varlab
outsheet using work.csv,names comma replace
save weom,replace
reshape long y,i(country iso var varlab estyr) j(year)
save work,replace
use work,clear
sort iso varlab
keep if iso=="AFG"
keep var
duplicates drop
gen n=_n
gen N=_N
reshape wide var, i(N) j(n)
drop N
*字串型变量上限为244字符[只能存入前32个变量名称(共46个)],所以拆成两断(长度分别为179和146)
*用空格做断点,为后面token做铺垫
*(试过别的不成,比如分号,逗号什么的,token会把这些符号存在positional local macro里)
egen name1=concat(var1-var23),punct(" ")
egen name2=concat(var24-var46),punct(" ")
keep name*
local x=name1
*断点识别符为空格
token `x',parse(" ")
* 因为后面标签也要用到positional local macro,所以这里变量名称要转存在其他local macro名下,
* 此处用nm1-nm46,分成两次(1-23和24-46),因为之前由于字串过长拆过。
forvalues i=1/23{
local nm`i' ``i''
}
local x=name2
*断点识别符为空格
token `x',parse(" ")
forvalues i=1/23{
local j=`i'+23
local nm`j' ``i''
}
use work,clear
*加标签
egen v=group(varlab)
levelsof varlab,l(v)
token `"`v'"',p("' `")
drop varlab var
reshape wide y,i(country iso year estyr) j(v)
forv i=1/46{
la var y`i' `"``i''"'
}
*标签加完
save new,replace
use new,clear
*重命名
forvalues i=1/46{
rename y`i' `nm`i''
}
save weooct2012,replace
以上办法可实现系统自动完成标签+命名(无需在rename或renvars中手动贴入变量名称)
经测,可行,不知有没有更好的办法,求解。


雷达卡




京公网安备 11010802022788号







