SASEMOOD Interface Engine

Example 24.1 Retrieving Consumer Price Index Data from Moody’s Analytics Data Buffet

This example requests Consumer Price Index data (all items, total for United States) from the OECD Main Economic Indicators database. The MNEMONIC= option specifies the Moody’s data to retrieve, which in this example is OCMCPALTT01IXOBAM.IUSA. The FREQ= option requests monthly data. The range is specified using the START= and END= options. The OUTJSON= option names the JSON file and the SAS output data set that contains the time series data from the downloaded JSON file. The CONV= option specifies cubic conversion to the desired frequency. The SAS system option VALIDVARNAME=ANY allows for the special character '.' in the mnemonic code; the same mnemonic code is used to name the SAS variable’s series name in the SAS output data set.

The SAS code is shown after the next paragraph, and it is followed by the output, shown in Output 24.1.1, for the selected date range.

The SET statement reads observations from the input data set Moody.monCPI, and the DATA step stores them in a SAS data set named myMONCPI. When all the data are retrieved, they are placed in a SAS data set that is named by the OUT= option and that is located in the folder specified by the physical-name in the LIBNAME statement.


options validvarname=any;

title 'Request Consumer Price Index (Total - All Items - Index 2015-100)';
LIBNAME moody sasemood "%sysget(MOOD_DATA)"
   mnemonic="OCMCPALTT01IXOBAM.IUSA"
   user='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
   pass='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
   freq=monthly
   conv=2
   outjson=moncpi
   start='2017-01-01'
   end='2018-05-01'
   format=json;

data myMONCPI;
   set moody.moncpi;
run;
proc print data=myMONCPI; run;

Output 24.1.1: US Monthly CPI Data in OECD Main Economic Indicators Database

Request Consumer Price Index (Total - All Items - Index 2015-100)

ObsdateOCMCPALTT01IXOBAM.IUSA
12017-01-31102.827
22017-02-28102.958
32017-03-31102.828
42017-04-30102.971
52017-05-31102.915
62017-06-30103.022
72017-07-31103.085
82017-08-31103.496
92017-09-30103.978
102017-10-31104.031
112017-11-30104.352
122017-12-31104.569
132018-01-31104.978
142018-02-28105.256
152018-03-31105.230
162018-04-30105.460
172018-05-31105.748


Last updated: July 09, 2026