SASEWBGO Interface Engine

Example 54.1 Reading Gross Domestic Product Data

(View the complete code for this example.)

This example shows how to access three of China’s GDP time series.


options validvarname=any;

title 'WBGO Data: Gross Domestic Product (3 Series) for China';
LIBNAME myLib sasewbgo "%sysget(WBGO)"
   OUTXML=g2start
   AUTOMAP=replace
   MAPREF=MyMap
   XMLMAP="%sysget(WBGO)g2start.map"
   COUNTRYLIST='chn'
   IDLIST='NY.GDP.PCAP.CD,NY.GDP.PCAP.KN,NY.GDP.PCAP.PP.KD'
   RANGE='2010:2016'
   ;

data gdp2chn;
   set myLib.g2start ;
run;
proc contents data=gdp2chn; run;
proc print data=gdp2chn(drop=total_count); run;

Output 54.1.1: WBGO Data: Gross Domestic Product for China

WBGO Data: Gross Domestic Product (3 Series) for China

Obs country_id date country NY.GDP.PCAP.CD NY.GDP.PCAP.KN NY.GDP.PCAP.PP.KD
1 CN 2010 China 4550.45 35167.06 8884.59
2 CN 2011 China 5618.13 38341.65 9686.62
3 CN 2012 China 6316.92 41155.72 10397.56
4 CN 2013 China 7050.65 44133.51 11149.87
5 CN 2014 China 7678.60 47171.32 11917.34
6 CN 2015 China 8066.94 50236.89 12691.82
7 CN 2016 China 8147.94 53387.62 13487.82


The SASEWBGO interface engine supports the XML format. The XML data that the WBGO website returns are placed in a file specified by the OUTXML= option. The XML map that is automatically created is assigned the full path name specified by the XMLMAP= option, and the fileref that is used for the map assignment is specified by the MAPREF= option.

To specify the list of time series that you want to retrieve, use the IDLIST= option. This option accepts a string enclosed in single quotation marks that denotes a list of time series indicators that you select for the resulting SAS data set. The series IDs (indicators) are separated by commas, so valid time series IDs cannot contain embedded commas or quotes. The gdp2chn data set contains three time series variables (NY.GDP.PCAP.CD, NY.GDP.PCAP.KN, and NY.GDP.PCAP.PP.KD), as specified in the IDLIST= option, and the observation range is controlled by the RANGE=’2010:2016’ option. The gdp2chn data set contains observations that range from the year 2010 to the year 2016, as specified by the RANGE= option. The frequency of the data is annual (default).

Note: The string '%20' is a special character for URL encoding of blanks. If the time series ID that you name in the IDLIST= option contains a blank, you must use '%20' wherever the blank appears in the time series name. If the time series ID contains an underscore, then you must use an underscore in the time series indicator. The blank and the underscore are not equivalent in the WBGO databases, so make sure that you use '%20' (URL encoded space) to designate blank characters.

Last updated: June 19, 2025