Resources

Read Tammer1's Superset containing Multiple Time Series

/*----------------------------------------------------------------

                   SAS SAMPLE LIBRARY

       Name: quanex07.sas
Description: Example program from SAS/ETS User's Guide,
             The SASEQUAN Interface Engine
      Title: Read Tammer1's Superset containing Multiple Time Series
    Product: SAS/ETS Software
       Keys: Quandl data extraction
      Procs: SASEQUAN
      Notes: Read this before you run this sample.
             The sample data provided resides in the ets/sasmisc folder.
             If you are using automap=READONLY, then you must copy the
             map of your incoming XML data to a writeable folder before
             using it. So, define a system environment variable
             ,QUANDL, to the path of your  writeable folder containing
             the quanex07.map file and QUANEX07.xml.
             To assign a fileref to the external file to be processed,
             use the following form of the libname statement:

           libname quan sasequan "%sysget(QUANDL)"
              FORMAT=XML
              OUTXML=quanex07
              AUTOMAP=replace
              MAPREF=MyMap
              XMLMAP="%sysget(QUANDL)quanex07.map"
              APIKEY='<your Quandl apikey>'
              IDLIST='<your list of Quandl codes>'
              START='<trim_start>'
              END='<trim-end>'
              COLLAPSE=annual
              ;
 ----------------------------------------------------------------*/

options validvarname=any
   sslcalistloc="/SASSecurityCertificateFramework/1.1/cacerts/trustedcerts.pem";

title 'Oil, Gold and S&P Index Stock Time Series Using the COLLAPSE= Option';
libname _all_ clear;
libname mylib "/sasusr/playpens/saskff/quan/doc/";

/* export QUANDL=/sasusr/playpens/saskff/quan/test/ */

libname mysup sasequan "/sasusr/playpens/saskff/quan/test/"
   apikey='XXXXXXXXXXXXXXXXXXXX'
   idlist='DOE/RWTC,BUNDESBANK/BBK01_WT5511,YAHOO/INDEX_GSPC'
   format=XML
   outXml=Tsupe
   automap=replace
   mapref=MyMap
   xmlmap="/sasusr/playpens/saskff/quan/test/Tsupe.map"
   start='1968-12-31'
   end='2014-03-27'
   collapse=annual
   ;

data mylib.Tsupe;
   set mysup.Tsupe;
   label Value_1 = "WTI Crude Oil Spot Price Cushing, OK FOB";
   label Value_2= "Gold Price (USD)";
   label Open_3= "S&P 500 Index Open";
   label High_3="S&P 500 Index High";
   label Low_3= "S&P 500 Index Low";
   label Close_3="S&P 500 Index Close";
   label Volume_3="S&P 500 Index Volume";
   label 'Adjusted Close_3'n ="S&P 500 Index Adjusted Close";
run;

proc contents data=mylib.Tsupe; run;
proc print data=mylib.Tsupe(obs=35) label; run;