The SASEQUAN Interface Engine

Example 50.1 Retrieving Historical Price Data for Oil India Limited

This example shows how to use one Quandl code, NSE/OIL, to retrieve historical prices for Oil India Limited, starting September 1, 2013, and ending November 5, 2013, with a daily frequency. The output is shown in Output 50.1.1.


options validvarname=any;

title 'Historical Prices for Oil India Limited';
libname _all_ clear;
libname mylib "U:\quan950\doc\";

libname myQoil sasequan "%sysget(QUANDL)"
   apikey='XXXXXXXXXXXXXXXXXXXX'
   idlist='NSE/OIL'
   format=XML
   outXml=oil
   automap=replace
   mapref=MyMap
   xmlmap="%sysget(QUANDL)oil.map"
   start='2013-09-01'
   end='2013-11-05'
   freq='daily'
   collapse='daily'
   ;

data mylib.oilall;
   set myQoil.oil;
run;
proc contents data=mylib.oilall; run;
proc print data=mylib.oilall; run;

Output 50.1.1: Historical Prices for Oil India Limited

Historical Prices for Oil India Limited

Obs date Open High Low Last Close Total Trade
Quantity
Turnover (Lacs)
1 2013-09-02 435.95 441.65 427.20 431.00 431.45 174437 755.45
2 2013-09-03 439.90 439.90 427.00 428.50 429.05 199749 860.41
3 2013-09-04 435.00 435.00 426.15 429.50 429.45 790295 3396.42
4 2013-09-05 430.00 439.95 430.00 435.00 432.60 586678 2539.29
5 2013-09-06 437.00 450.00 433.30 445.25 445.15 543652 2402.79
6 2013-09-10 450.00 465.00 446.10 462.10 460.65 663553 2997.61
7 2013-09-11 462.00 485.00 461.00 466.00 466.70 371647 1733.05
8 2013-09-12 458.05 466.00 446.10 448.70 448.10 211533 959.45
9 2013-09-13 452.50 484.00 448.15 471.05 470.25 826546 3884.01
10 2013-09-16 483.70 484.00 458.80 476.00 467.00 335598 1593.84
11 2013-09-17 467.00 479.20 460.35 473.00 475.55 241830 1148.25
12 2013-09-18 471.20 481.85 471.20 480.00 479.70 182343 868.29
13 2013-09-19 485.00 499.00 476.00 491.10 493.75 457626 2236.70
14 2013-09-20 493.00 493.00 459.00 472.15 466.50 295333 1393.19
15 2013-09-23 466.75 487.00 464.00 480.00 480.40 273803 1302.58
16 2013-09-24 481.90 481.90 464.10 466.00 465.80 314456 1486.22
17 2013-09-25 467.90 473.30 466.10 470.15 470.35 738597 3472.11
18 2013-09-26 471.00 473.70 447.30 453.00 451.95 537088 2434.72
19 2013-09-27 456.70 462.00 450.10 452.00 454.30 345246 1571.16
20 2013-09-30 449.70 457.80 435.00 435.25 437.40 394564 1742.00
21 2013-10-01 437.15 449.35 432.00 449.00 447.90 308033 1367.86
22 2013-10-03 448.00 461.00 444.15 457.10 458.90 197974 898.93
23 2013-10-04 456.95 464.00 455.55 461.50 461.10 227214 1047.43
24 2013-10-07 464.90 471.45 450.00 468.00 464.40 240571 1098.48
25 2013-10-08 467.00 471.65 461.00 463.00 462.25 208627 964.45
26 2013-10-09 462.00 465.80 456.75 465.50 465.10 101852 472.35
27 2013-10-10 465.10 468.50 459.20 460.30 462.25 339738 1578.62
28 2013-10-11 465.00 468.70 457.00 467.50 463.25 213591 983.10
29 2013-10-14 464.65 467.90 461.00 464.10 463.95 125129 580.40
30 2013-10-15 464.00 471.80 456.55 459.30 460.55 407231 1877.01
31 2013-10-17 460.50 465.00 452.50 453.20 454.40 220366 1009.36
32 2013-10-18 457.00 465.95 457.00 465.00 464.55 185891 857.04
33 2013-10-21 465.00 471.90 458.70 468.00 468.85 114130 531.62
34 2013-10-22 468.85 473.20 461.15 465.70 466.65 198435 924.12
35 2013-10-23 463.05 469.50 451.40 456.00 457.65 469852 2152.30
36 2013-10-24 458.00 462.95 452.00 452.00 453.40 246085 1126.66
37 2013-10-25 458.00 460.05 450.00 454.00 454.65 272926 1238.47
38 2013-10-28 455.00 459.70 445.10 457.00 454.10 173547 785.17
39 2013-10-29 457.00 469.30 451.50 464.00 459.95 258106 1179.18
40 2013-10-30 460.20 467.80 453.95 463.50 463.25 301971 1391.67
41 2013-10-31 463.00 481.00 456.00 473.00 473.85 472301 2221.88
42 2013-11-01 470.10 481.00 464.50 480.00 475.05 318091 1495.83
43 2013-11-03 479.00 482.20 475.25 476.00 477.70 34250 163.85
44 2013-11-05 475.05 476.90 465.10 467.05 469.35 190319 894.87