The SASEQUAN Interface Engine

Example 50.5 Collapsing Data for the JASDAQ-TOP20 Exchange Traded Fund (ETF)

This example shows how to collapse the daily data to a weekly interval by using the same Quandl code as in Example 50.4, GOOG/TYO_1551, to retrieve the price and yield performance of the JASDAQ-TOP20 Exchange Traded Fund (ETF) in Japan, starting January 1, 2014, and ending March 26, 2014, with a daily native frequency, collapsing to a weekly frequency by using the COLLAPSE= option. The output is shown in Output 50.5.1.


options validvarname=any;

title 'JASDAQ-TOP20 ETF, COLLAPSE=WEEKLY Option';
libname _all_ clear;
libname mylib "U:\quan950\doc\";

libname myTOP20 sasequan "%sysget(QUANDL)"
   apikey='XXXXXXXXXXXXXXXXXXXX'
   idlist='GOOG/TYO_1551'
   format=XML
   outXml=jasdaqW
   automap=replace
   mapref=MyMap
   xmlmap="%sysget(QUANDL)jasdaqw.map"
   start='2014-01-01'
   end='2014-03-26'
   collapse=weekly
   ;

data mylib.jasdaqW;
   set myTOP20.jasdaqW;
run;
proc contents data=mylib.jasdaqW; run;
proc print data=mylib.jasdaqW; run;

Output 50.5.1: JASDAQ-TOP20 ETF, with COLLAPSE=WEEKLY

JASDAQ-TOP20 ETF, COLLAPSE=WEEKLY Option

Obs date Open High Low Close Volume
1 2014-01-12 6150 6190 6060 6100 13980
2 2014-01-19 5910 6010 5850 6000 8130
3 2014-01-26 5820 6050 5700 5920 23250
4 2014-02-02 5780 5820 5550 5620 8440
5 2014-02-09 5670 5700 5550 5590 8070
6 2014-02-16 5660 5700 5480 5520 6990
7 2014-02-23 5700 5770 5640 5640 8550
8 2014-03-02 5830 5830 5650 5670 4420
9 2014-03-09 5870 5890 5850 5850 3740
10 2014-03-16 5550 5620 5420 5470 9030
11 2014-03-23 5300 5340 5130 5140 4780
12 2014-03-30 4860 5010 4850 4950 9100