(View the complete code for this example.)
This example demonstrates how to use the URL= option to retrieve a list of available time series indicators for a specified topic.
options validvarname=any;
title 'Retrieve a List of Indicators for a Specified Topic ID Using the URL= Option';
libname wbgo sasewbgo "%sysget(WBGO)"
url="http://api.worldbank.org/v2/topic/5/indicator?format=xml"
page=2;
data my5top2;
set wbgo.XWBGOTPU;
run;
proc contents data=my5top2; run;
proc print data=my5top2; run;
Output 54.7.1: Specifying the URL= Option for a List of Indicators for a Specified Topic
| Retrieve a List of Indicators for a Specified Topic ID Using the URL= Option |
| Obs | topic_id | topic | indicator_id | name | source_id | source |
|---|---|---|---|---|---|---|
| 1 | 5 | Energy & Mining | TM.VAL.MMTL.ZS.UN | Ores and metals imports (% of merchandise imports) | 2 | World Development Indicators |
| 2 | 12 | Private Sector | TM.VAL.MMTL.ZS.UN | Ores and metals imports (% of merchandise imports) | 2 | World Development Indicators |
| 3 | 21 | Trade | TM.VAL.MMTL.ZS.UN | Ores and metals imports (% of merchandise imports) | 2 | World Development Indicators |
| 4 | 5 | Energy & Mining | TX.VAL.FUEL.ZS.UN | Fuel exports (% of merchandise exports) | 2 | World Development Indicators |
| 5 | 12 | Private Sector | TX.VAL.FUEL.ZS.UN | Fuel exports (% of merchandise exports) | 2 | World Development Indicators |
| 6 | 21 | Trade | TX.VAL.FUEL.ZS.UN | Fuel exports (% of merchandise exports) | 2 | World Development Indicators |
| 7 | 5 | Energy & Mining | TX.VAL.MMTL.ZS.UN | Ores and metals exports (% of merchandise exports) | 2 | World Development Indicators |
| 8 | 12 | Private Sector | TX.VAL.MMTL.ZS.UN | Ores and metals exports (% of merchandise exports) | 2 | World Development Indicators |
| 9 | 21 | Trade | TX.VAL.MMTL.ZS.UN | Ores and metals exports (% of merchandise exports) | 2 | World Development Indicators |
Output 54.7.1 shows page 2 of the results. You can retrieve page 1 by removing the PAGE=2 option from the LIBNAME statement. Even though an indicator is selected based on the specified topic ID, all corresponding topics for that selected indicator are listed in the results.