Code:
cap program drop wdi2panel program define wdi2panel frame create name frame change name input str52 CountryName str3 CountryCode str57 国家Name "Aruba" "ABW" "阿鲁巴" "Africa Eastern and Southern" "AFE" "非洲东部和南部" "Afghanistan" "AFG" "阿富汗" "Africa Western and Central" "AFW" "非洲西部和中部" "Angola" "AGO" "安哥拉" "Albania" "ALB" "阿尔巴尼亚" "Andorra" "AND" "安道尔共和国" "Arab World" "ARB" "阿拉伯联盟国家" "United Arab Emirates" "ARE" "阿拉伯联合酋长国" "Argentina" "ARG" "阿根廷" "Armenia" "ARM" "亚美尼亚" "American Samoa" "ASM" "美属萨摩亚" "Antigua and Barbuda" "ATG" "安提瓜和巴布达" "Australia" "AUS" "澳大利亚" "Austria" "AUT" "奥地利" "Azerbaijan" "AZE" "阿塞拜疆" "Burundi" "BDI" "布隆迪" "Belgium" "BEL" "比利时" "Benin" "BEN" "贝宁" "Burkina Faso" "BFA" "布基纳法索" "Bangladesh" "BGD" "孟加拉国" "Bulgaria" "BGR" "保加利亚" "Bahrain" "BHR" "巴林" "Bahamas, The" "BHS" "巴哈马" "Bosnia and Herzegovina" "BIH" "波斯尼亚和黑塞哥维那" "Belarus" "BLR" "白俄罗斯" "Belize" "BLZ" "伯利兹" "Bermuda" "BMU" "百慕大" "Bolivia" "BOL" "玻利维亚" "Brazil" "BRA" "巴西" "Barbados" "BRB" "巴巴多斯" "Brunei Darussalam" "BRN" "文莱达鲁萨兰国" "Bhutan" "BTN" "不丹" "Botswana" "BWA" "博茨瓦纳" "Central African Republic" "CAF" "中非共和国" "Canada" "CAN" "加拿大" "Central Europe and the Baltics" "CEB" "中歐和波羅的海" "Switzerland" "CHE" "瑞士" "Channel Islands" "CHI" "海峡群岛" "Chile" "CHL" "智利" "China" "CHN" "中国" "Cote d'Ivoire" "CIV" "科特迪瓦" "Cameroon" "CMR" "喀麦隆" "Congo, Dem. Rep." "COD" "刚果(金)" "Congo, Rep." "COG" "刚果(布)" "Colombia" "COL" "哥伦比亚" "Comoros" "COM" "科摩罗" "Cabo Verde" "CPV" "佛得角" "Costa Rica" "CRI" "哥斯达黎加" "Caribbean small states" "CSS" "加勒比小国" "Cuba" "CUB" "古巴" "Curacao" "CUW" "库拉索" "Cayman Islands" "CYM" "开曼群岛" "Cyprus" "CYP" "塞浦路斯" "Czech Republic" "CZE" "捷克共和国" "Germany" "DEU" "德国" "Djibouti" "DJI" "吉布提" "Dominica" "DMA" "多米尼克" "Denmark" "DNK" "丹麦" "Dominican Republic" "DOM" "多米尼加共和国" "Algeria" "DZA" "阿尔及利亚" "East Asia & Pacific (excluding high income)" "EAP" "东亚与太平洋地区(不包括高收入)" "Early-demographic dividend" "EAR" "早人口紅利" "East Asia & Pacific" "EAS" "东亚与太平洋地区" "Europe & Central Asia (excluding high income)" "ECA" "欧洲与中亚地区(不包括高收入)" "Europe & Central Asia" "ECS" "欧洲与中亚地区" "Ecuador" "ECU" "厄瓜多尔" "Egypt, Arab Rep." "EGY" "阿拉伯埃及共和国" "Euro area" "EMU" "欧洲货币联盟" "Eritrea" "ERI" "厄立特里亚" "Spain" "ESP" "西班牙" "Estonia" "EST" "爱沙尼亚" "Ethiopia" "ETH" "埃塞俄比亚" "European Union" "EUU" "欧洲联盟" "Fragile and conflict affected situations" "FCS" "脆弱和受衝突影響的情況下" "Finland" "FIN" "芬兰" "Fiji" "FJI" "斐济" "France" "FRA" "法国" "Faroe Islands" "FRO" "法罗群岛" "Micronesia, Fed. Sts." "FSM" "密克罗尼西亚联邦" "Gabon" "GAB" "加蓬" "United Kingdom" "GBR" "英国" "Georgia" "GEO" "格鲁吉亚" "Ghana" "GHA" "加纳" "Gibraltar" "GIB" "直布罗陀" "Guinea" "GIN" "几内亚" "Gambia, The" "GMB" "冈比亚" "Guinea-Bissau" "GNB" "几内亚比绍共和国" "Equatorial Guinea" "GNQ" "赤道几内亚" "Greece" "GRC" "希腊" "Grenada" "GRD" "格林纳达" "Greenland" "GRL" "格陵兰" "Guatemala" "GTM" "危地马拉" "Guam" "GUM" "关岛" "Guyana" "GUY" "圭亚那" "High income" "HIC" "高收入国家" "Hong Kong SAR, China" "HKG" "中国香港特别行政区" "Honduras" "HND" "洪都拉斯" "Heavily indebted poor countries (HIPC)" "HPC" "重债穷国 (HIPC)" "Croatia" "HRV" "克罗地亚" "Haiti" "HTI" "海地" "Hungary" "HUN" "匈牙利" "IBRD only" "IBD" "只有IBRD" "IDA & IBRD total" "IBT" "IBRD与IDA" "IDA total" "IDA" "IDA總" "IDA blend" "IDB" "IDA混合" "Indonesia" "IDN" "印度尼西亚" "IDA only" "IDX" "只有IDA" "Isle of Man" "IMN" "马恩岛" "India" "IND" "印度" "Not classified" "INX" "未分类国家" "Ireland" "IRL" "爱尔兰" "Iran, Islamic Rep." "IRN" "伊朗伊斯兰共和国" "Iraq" "IRQ" "伊拉克" "Iceland" "ISL" "冰岛" "Israel" "ISR" "以色列" "Italy" "ITA" "意大利" "Jamaica" "JAM" "牙买加" "Jordan" "JOR" "约旦" "Japan" "JPN" "日本" "Kazakhstan" "KAZ" "哈萨克斯坦" "Kenya" "KEN" "肯尼亚" "Kyrgyz Republic" "KGZ" "吉尔吉斯斯坦" "Cambodia" "KHM" "柬埔寨" "Kiribati" "KIR" "基里巴斯" "St. Kitts and Nevis" "KNA" "圣基茨和尼维斯" "Korea, Rep." "KOR" "大韩民国" "Kuwait" "KWT" "科威特" "Latin America & Caribbean (excluding high income)" "LAC" "拉丁美洲与加勒比海地区(不包括高收入)" "Lao PDR" "LAO" "老挝" "Lebanon" "LBN" "黎巴嫩" "Liberia" "LBR" "利比里亚" "Libya" "LBY" "利比亚" "St. Lucia" "LCA" "圣卢西亚" "Latin America & Caribbean" "LCN" "拉丁美洲与加勒比海地区" "Least developed countries: UN classification" "LDC" "最不发达国家:联合国分类" "Low income" "LIC" "低收入国家" "Liechtenstein" "LIE" "列支敦士登" "Sri Lanka" "LKA" "斯里兰卡" "Lower middle income" "LMC" "中低等收入国家" "Low & middle income" "LMY" "中低收入国家" "Lesotho" "LSO" "莱索托" "Late-demographic dividend" "LTE" "後期人口紅利" "Lithuania" "LTU" "立陶宛" "Luxembourg" "LUX" "卢森堡" "Latvia" "LVA" "拉脱维亚" "Macao SAR, China" "MAC" "中国澳门特别行政区" "St. Martin (French part)" "MAF" "圣马丁(法属)" "Morocco" "MAR" "摩洛哥" "Monaco" "MCO" "摩纳哥" "Moldova" "MDA" "摩尔多瓦" "Madagascar" "MDG" "马达加斯加" "Maldives" "MDV" "马尔代夫" "Middle East & North Africa" "MEA" "中东与北非地区" "Mexico" "MEX" "墨西哥" "Marshall Islands" "MHL" "马绍尔群岛" "Middle income" "MIC" "中等收入国家" "North Macedonia" "MKD" "北马其顿" "Mali" "MLI" "马里" "Malta" "MLT" "马耳他" "Myanmar" "MMR" "缅甸" "Middle East & North Africa (excluding high income)" "MNA" "中东与北非地区(不包括高收入)" "Montenegro" "MNE" "黑山" "Mongolia" "MNG" "蒙古" "Northern Mariana Islands" "MNP" "北马里亚纳群岛" "Mozambique" "MOZ" "莫桑比克" "Mauritania" "MRT" "毛里塔尼亚" "Mauritius" "MUS" "毛里求斯" "Malawi" "MWI" "马拉维" "Malaysia" "MYS" "马来西亚" "North America" "NAC" "北美" "Namibia" "NAM" "纳米比亚" "New Caledonia" "NCL" "新喀里多尼亚" "Niger" "NER" "尼日尔" "Nigeria" "NGA" "尼日利亚" "Nicaragua" "NIC" "尼加拉瓜" "Netherlands" "NLD" "荷兰" "Norway" "NOR" "挪威" "Nepal" "NPL" "尼泊尔" "Nauru" "NRU" "瑙魯" "New Zealand" "NZL" "新西兰" "OECD members" "OED" "经合组织成员" "Oman" "OMN" "阿曼" "Other small states" "OSS" "其他小国" "Pakistan" "PAK" "巴基斯坦" "Panama" "PAN" "巴拿马" "Peru" "PER" "秘鲁" "Philippines" "PHL" "菲律宾" "Palau" "PLW" "帕劳" "Papua New Guinea" "PNG" "巴布亚新几内亚" "Poland" "POL" "波兰" "Pre-demographic dividend" "PRE" "預人口紅利" "Puerto Rico" "PRI" "波多黎各" "Korea, Dem. People's Rep." "PRK" "朝鲜民主主义人民共和国" "Portugal" "PRT" "葡萄牙" "Paraguay" "PRY" "巴拉圭" "West Bank and Gaza" "PSE" "约旦河西岸和加沙" "Pacific island small states" "PSS" "太平洋岛国" "Post-demographic dividend" "PST" "人口紅利之後" "French Polynesia" "PYF" "法属波利尼西亚" "Qatar" "QAT" "卡塔尔" "Romania" "ROU" "罗马尼亚" "Russian Federation" "RUS" "俄罗斯联邦" "Rwanda" "RWA" "卢旺达" "South Asia" "SAS" "南亚" "Saudi Arabia" "SAU" "沙特阿拉伯" "Sudan" "SDN" "苏丹" "Senegal" "SEN" "塞内加尔" "Singapore" "SGP" "新加坡" "Solomon Islands" "SLB" "所罗门群岛" "Sierra Leone" "SLE" "塞拉利昂" "El Salvador" "SLV" "萨尔瓦多" "San Marino" "SMR" "圣马力诺" "Somalia" "SOM" "索马里" "Serbia" "SRB" "塞尔维亚" "Sub-Saharan Africa (excluding high income)" "SSA" "撒哈拉以南非洲地区(不包括高收入)" "South Sudan" "SSD" "南苏丹" "Sub-Saharan Africa" "SSF" "撒哈拉以南非洲地区" "Small states" "SST" "小国" "Sao Tome and Principe" "STP" "圣多美和普林西比" "Suriname" "SUR" "苏里南" "Slovak Republic" "SVK" "斯洛伐克共和国" "Slovenia" "SVN" "斯洛文尼亚" "Sweden" "SWE" "瑞典" "Eswatini" "SWZ" "斯威士兰" "Sint Maarten (Dutch part)" "SXM" "圣马丁(荷属)" "Seychelles" "SYC" "塞舌尔" "Syrian Arab Republic" "SYR" "阿拉伯叙利亚共和国" "Turks and Caicos Islands" "TCA" "特克斯科斯群岛" "Chad" "TCD" "乍得" "East Asia & Pacific (IDA & IBRD countries)" "TEA" "东亚与太平洋地区 (IBRD与IDA)" "Europe & Central Asia (IDA & IBRD countries)" "TEC" "欧洲与中亚地区 (IBRD与IDA)" "Togo" "TGO" "多哥" "Thailand" "THA" "泰国" end frame change default cap confirm variable CountryName if !_rc { cap drop if mi(CountryCode) egen id1=group(CountryName SeriesName) reshape2l long YR,i(id1) j(year) egen id2=group(SeriesName) reshape wide YR,i(id1 year) j(id2) replace SeriesCode=strtoname(SeriesCode) levelsof SeriesCode,local(codelevels) levelsof SeriesName,local(namelevels) collapse (firstnm) YR*,by(CountryName CountryCode year) local i=1 //将变量名存放在标签里 foreach v of local namelevels{ label variable YR`i' "`v'" local ++i } local i=1 //变量名使用系列code foreach v of local codelevels{ destring YR`i',force replace ren YR`i' `v' local ++i } frlink m:1 CountryCode,frame(name) frget 国家Name ,from(name) order CountryName 国家Name CountryCode year } else { cap drop if mi(国家Code) cap replace 国家Name= "非洲东部和南部" if 国家Code=="AFE" cap replace 国家Name= "非洲西部和中部" if 国家Code=="AFW" egen id1=group(国家Name 系列Name) reshape2l long YR,i(id1) j(year) egen id2=group(系列Name) reshape wide YR,i(id1 year) j(id2) replace 系列Code=strtoname(系列Code) levelsof 系列Code,local(codelevels) levelsof 系列Name,local(namelevels) collapse (firstnm) YR*,by(国家Name 国家Code year) local i=1 //将变量名存放在标签里 foreach v of local namelevels{ label variable YR`i' "`v'" local ++i } local i=1 //变量名使用系列code foreach v of local codelevels{ destring YR`i',force replace ren YR`i' `v' local ++i } frlink m:1 国家Code,frame(name CountryCode) frget CountryName ,from(name) drop name order 国家Name CountryName 国家Code year compress } end
Code:
clear frames
import excel "Data_Extract_From_World_Development_Indicators.xlsx",firstrow clear
wdi2panel
(error occurred while loading wdi2panel.ado)
r(9611);
0 Response to quesiton about Stata program
Post a Comment