SASEMOOD Interface Engine
Getting Started: SASEMOOD Interface Engine
You need a subscription to use Moody’s Analytics Data Buffet web service, and you must have the proper credentials to access this service. For more information, see "Using Data Buffet: Data Buffet API v1.0" (Thorne 2019b). After you log on, you will see your access key and encryption key in your account information at the following URL:
https://www.economy.com/myeconomy/api-key-info
For more information about getting started using Data Buffet, see "Using Data Buffet: Which Series Can You Download?" (Thorne 2019f).
The web page at the following URL describes how to use the Moody’s Analytics Data Buffet API (Moody’s Analytics 2019):
The statements at the end of this section enable you to access the mnemonic GDP$.IUSA, which is described as "Gross domestic product, (Mil. Ch 2012 USD, SAAR) for United States."
The MNEMONIC= option specifies the time series mnemonic code(s) that you need in order to retrieve the data from Moody’s Analytics Data Buffet. GDP$.IUSA is the time series mnemonic code in the sample code shown at the end of this section.
The OUT= option specifies both the name of the resulting JSON file(s) and the name of the SAS data set.
The range of the retrieved data is determined by the START= and END= options. You specify the start and end dates in 'YYYY-MM-DD' format.
The JSON data that the Moody’s Analytics Data Buffet website returns are placed in a file that is named by the OUT= option—in this case, GDP1.json.
Note: The SASEMOOD engine appends a numeral to the JSON file name, and the file extension (.json) is excluded from the file name that appears in the OUT= option. When the SET statement is executed, the JSON data are read (and merged) into a SAS data set named GDP.sas7bdat, which resides in the location that is specified inside the string enclosed in double quotation marks in the LIBNAME statement.
The result is named in the DATA step in the SET statement and is shown in Figure 1.
For another example that uses more LIBNAME statement options, see the section Examples: SASEMOOD Interface Engine.
options;
title 'Retrieve Gross Domestic Product Data for United States';
libname mylib "/sasusr/mood/";
title1 "National Income and Product Accounts Databank from Moody's Analytics Data Buffet";
title2 "Request US Gross Domestic Product";
libname moody sasemood "%sysget(MOOD_DATA)"
mnemonic="GDP$.IUSA" /* steps 2 and 3 */
user='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' /* access key */
pass='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' /* encryption key */
freq=quarterly
conv=2
outjson=GDP
start='2017-01-01'
end='2017-12-01'
;
data mylib.myGDP;
set moody.GDP; /* GDP is specified in the OUT= option */
run;
title3 "The mylib.myGDP Data Set";
proc print data=mylib.myGDP; run;
Figure 1: US Gross Domestic Product
| National Income and Product Accounts Databank from Moody's Analytics Data Buffet |
| Request US Gross Domestic Product |
| The mylib.myGDP Data Set |
| Obs | date | GDP$.IUSA |
|---|---|---|
| 1 | 2017-03-31 | 17925256 |
| 2 | 2017-06-30 | 18021048 |
| 3 | 2017-09-30 | 18163558 |
| 4 | 2017-12-31 | 18322464 |