The SASEQUAN Interface Engine

Example 43.7 Reading Superset Data for Multiple Time Series

This example shows how to read data from a Quandl superset by using the Quandl code TAMMER1/6KY to retrieve oil, gold, and stock prices. This superset is described at the following URL: http://www.quandl.com/TAMMER1/6KY-GoldOil-Gold-and-Stocks .

There are three superset columns (Oil, Gold, and S&P500), taken from three different Quandl data sets: DOE/_RWTC, BBK01/_WT5511, and YAHOO/_INDEX_GSPC, respectively. Because the Oil, Gold, and S&P500 columns are all from a daily native frequency data set, you can use the collapse frequency "Annual" to minimize the missing values in the output. In the following example, specify a range by using START='1961-12-31' and END='2014-03-27', and specify a collapse frequency by using COLLAPSE=ANNUAL. The output is shown in Output 43.7.1.


options validvarname=any;

title 'TAMMER1/6KY Superset with Multiple Time Series Using the COLLAPSE= Option';
libname _all_ clear;
libname mylib "U:\quan950\doc\";

libname myTAM sasequan "%sysget(QUANDL)"
   apikey='XXXXXXXXXXXXXXXXXXXX'
   idlist='TAMMER1/6KY'
   format=XML
   outXml=superT
   automap=replace
   mapref=MyMap
   xmlmap="%sysget(QUANDL)superT.map"
   start='1961-12-31'
   end='2014-03-27'
   collapse=annual
   ;

data mylib.superT;
   set myTAM.superT;
run;
proc contents data=mylib.superT; run;
proc print data=mylib.superT; run;

Output 43.7.1: Quandl Superset for Multiple Time Series (Oil, Gold, and Stocks) Using COLLAPSE= Option

TAMMER1/6KY Superset with Multiple Time Series Using the COLLAPSE= Option

Obs date Oil Gold S&P500
1 1961-12-31 . . 71.55
2 1962-12-31 . . 63.10
3 1963-12-31 . . 75.02
4 1964-12-31 . . 84.75
5 1965-12-31 . . 92.43
6 1966-12-31 . . 80.33
7 1967-12-31 . . 96.47
8 1968-12-31 . 41.95 103.86
9 1969-12-31 . 35.21 92.06
10 1970-12-31 . 37.38 92.15
11 1971-12-31 . 43.64 102.09
12 1972-12-31 . 64.70 118.05
13 1973-12-31 . 112.25 97.55
14 1974-12-31 . 187.50 68.56
15 1975-12-31 . 140.25 90.19
16 1976-12-31 . 134.55 107.46
17 1977-12-31 . 165.60 95.10
18 1978-12-31 . 224.50 96.11
19 1979-12-31 . 524.00 107.94
20 1980-12-31 . 589.50 135.76
21 1981-12-31 . 400.00 122.55
22 1982-12-31 . 448.00 140.64
23 1983-12-31 . 381.50 164.93
24 1984-12-31 . 309.00 167.24
25 1985-12-31 . 327.00 211.28
26 1986-12-31 17.93 390.90 242.17
27 1987-12-31 16.74 486.50 247.08
28 1988-12-31 17.12 410.15 277.72
29 1989-12-31 21.84 401.00 353.40
30 1990-12-31 28.48 391.00 330.22
31 1991-12-31 19.15 353.40 417.09
32 1992-12-31 19.49 332.90 435.71
33 1993-12-31 14.19 390.65 466.45
34 1994-12-31 17.77 382.50 459.27
35 1995-12-31 19.54 386.70 615.93
36 1996-12-31 25.90 369.55 740.74
37 1997-12-31 17.65 289.20 970.43
38 1998-12-31 12.14 287.45 1229.23
39 1999-12-31 25.76 290.85 1469.25
40 2000-12-31 26.72 272.65 1320.28
41 2001-12-31 19.96 276.50 1148.08
42 2002-12-31 31.21 342.75 879.82
43 2003-12-31 32.51 417.25 1111.92
44 2004-12-31 43.36 438.00 1211.92
45 2005-12-31 61.06 513.00 1248.29
46 2006-12-31 60.85 635.70 1418.30
47 2007-12-31 95.95 836.50 1468.36
48 2008-12-31 44.60 865.00 903.25
49 2009-12-31 79.39 1104.00 1115.10
50 2010-12-31 91.38 1410.25 1257.64
51 2011-12-31 98.83 1574.50 1257.60
52 2012-12-31 91.83 1664.00 1426.19
53 2013-12-31 98.17 1201.50 1848.36
54 2014-12-31 104.05 1299.00 1864.85