SASEMOOD Interface Engine

Example 24.4 Retrieving Daily Data from the S&P 500

This example shows how to retrieve Standard & Poor’s Dow Jones Indices data, starting in January 2018 and ending in February 2018. The output is shown in Output 24.4.1. The MNEMONIC= option specifies the Moody’s data set to retrieve the data from; its mnemonic code is SP500D.IUSA. 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 START= and END= options define the date range.


options validvarname=any;

title 'Request S&P 500 Data, Daily Data';
LIBNAME moody sasemood "%sysget(MOOD_DATA)"
   mnemonic="SP500D.IUSA"
   user='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
   pass='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
   freq=daily
   conv=cubic
   outjson=sp500
   start='2018-01-01'
   end='2018-02-01'
   format=json
   ;

data mySP500;
    set moody.sp500;
run;

proc print data=work.mySP500; run;

Output 24.4.1: Stock Price Index: S&P 500 (Index 1941 to 1943=10, NSA)

Request S&P 500 Data, Daily Data

ObsdateSP500D.IUSA
12018-01-012688.01
22018-01-022695.81
32018-01-032713.06
42018-01-042723.99
52018-01-052743.15
62018-01-062746.41
72018-01-072747.02
82018-01-082749.70
92018-01-092751.29
102018-01-102748.23
112018-01-112767.56
122018-01-122786.24
132018-01-132784.92
142018-01-142780.31
152018-01-152775.69
162018-01-162776.42
172018-01-172802.56
182018-01-182798.03
192018-01-192810.30
202018-01-202824.21
212018-01-212836.14
222018-01-222838.57
232018-01-232839.13
242018-01-242837.54
252018-01-252839.25
262018-01-262872.87
272018-01-272868.00
282018-01-282854.91
292018-01-292837.68
302018-01-302822.43
312018-01-312823.81
322018-02-012821.98


Last updated: July 09, 2026