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;
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 |
| Obs | date | SP500D.IUSA |
|---|---|---|
| 1 | 2018-01-01 | 2688.01 |
| 2 | 2018-01-02 | 2695.81 |
| 3 | 2018-01-03 | 2713.06 |
| 4 | 2018-01-04 | 2723.99 |
| 5 | 2018-01-05 | 2743.15 |
| 6 | 2018-01-06 | 2746.41 |
| 7 | 2018-01-07 | 2747.02 |
| 8 | 2018-01-08 | 2749.70 |
| 9 | 2018-01-09 | 2751.29 |
| 10 | 2018-01-10 | 2748.23 |
| 11 | 2018-01-11 | 2767.56 |
| 12 | 2018-01-12 | 2786.24 |
| 13 | 2018-01-13 | 2784.92 |
| 14 | 2018-01-14 | 2780.31 |
| 15 | 2018-01-15 | 2775.69 |
| 16 | 2018-01-16 | 2776.42 |
| 17 | 2018-01-17 | 2802.56 |
| 18 | 2018-01-18 | 2798.03 |
| 19 | 2018-01-19 | 2810.30 |
| 20 | 2018-01-20 | 2824.21 |
| 21 | 2018-01-21 | 2836.14 |
| 22 | 2018-01-22 | 2838.57 |
| 23 | 2018-01-23 | 2839.13 |
| 24 | 2018-01-24 | 2837.54 |
| 25 | 2018-01-25 | 2839.25 |
| 26 | 2018-01-26 | 2872.87 |
| 27 | 2018-01-27 | 2868.00 |
| 28 | 2018-01-28 | 2854.91 |
| 29 | 2018-01-29 | 2837.68 |
| 30 | 2018-01-30 | 2822.43 |
| 31 | 2018-01-31 | 2823.81 |
| 32 | 2018-02-01 | 2821.98 |
Last updated: July 09, 2026