Retrieving Data for Three FRED Quandl Codes
/*----------------------------------------------------------------
SAS SAMPLE LIBRARY
Name: quanex02.sas
Description: Example program from SAS/ETS User's Guide,
The SASEQUAN Interface Engine
Title: Retrieving Data for Three FRED Quandl Codes
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 quanex02.map file and QUANEX02.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)"
OUTXML=quanex02
AUTOMAP=replace
MAPREF=MyMap
XMLMAP="%sysget(QUANDL)quanex02.map"
APIKEY='<your Quandl apikey>'
IDLIST='<your list of Quandl codes (separated by commas>'
START='<trim_start>'
END='<trim-end>'
;
----------------------------------------------------------------*/
title 'Retrieve Data for Three Time Series: FRED/CP, FRED/GDP, FRED/TOTALSL';
libname _all_ clear;
options validvarname=any
sslcalistloc="/SASSecurityCertificateFramework/1.1/cacerts/trustedcerts.pem";
libname mylib "/sasusr/playpens/saskff/quan/doc/";
/* export QUANDL=/sasusr/playpens/saskff/quan/test/ */
libname myQ3 sasequan "/sasusr/playpens/saskff/quan/test/"
OUTXML=fred3
AUTOMAP=replace
MAPREF=MyMap
XMLMAP="/sasusr/playpens/saskff/quan/test/fred3.map"
APIKEY='XXXXXXXXXXXXXXXXXXXX'
IDLIST='FRED/CP,FRED/GDP,FRED/TOTALSL'
FORMAT=xml
START='2009-07-01'
END='2013-07-01'
FREQ='quarterly'
COLLAPSE='quarterly'
;
data mylib.thrall;
set myQ3.fred3;
label Value_1 = "Corporate Profits After Tax";
label Value_2 = "Gross Domestic Product, 1 Decimal";
label Value_3 = "Total Consumer Credit Owned and Securitized, Outstanding";
run;
proc contents data=mylib.thrall; run;
proc print data=mylib.thrall label; run;