The SASEFRED Interface Engine

Example 39.1 Retrieving Data for Multiple Time Series

This example shows how to use multiple time series IDs to retrieve the average balance of payment basis data for the exports (BOPXGS) and imports (BOPMGS) of goods and services for the last 15 years, starting 1997-01-01 and ending 2011-01-01, with an annual frequency.

title 'Retrieve Balance of Payment Data for the Exports and Imports';
libname _all_ clear;

libname fred sasefred "%sysget(FRED)"
   OUTXML=fredex01
   AUTOMAP=replace
   MAPREF=MyMap
   XMLMAP="%sysget(FRED)fredex01.map"
   APIKEY='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
   IDLIST='bopxgs,bopmgs'
   START='1997-01-01'
   END='2011-01-01'
   FREQ='a'
   OUTPUT=1
   AGG='avg'
   FORMAT=xml;

data export_import;
   set fred.fredex01 ;
run;
proc contents data=export_import; run;
proc print data=export_import; run;

Output 39.1.1: Retrieve Balance of Payment Data for the Exports and Imports

Retrieve Balance of Payment Data for the Exports and Imports

Obs date realtime_start realtime_end BOPXGS BOPMGS
1 1997-01-01 2014-03-17 2014-03-17 233.614 -260.682
2 1998-01-01 2014-03-17 2014-03-17 233.293 -274.829
3 1999-01-01 2014-03-17 2014-03-17 241.752 -307.691
4 2000-01-01 2014-03-17 2014-03-17 268.196 -362.531
5 2001-01-01 2014-03-17 2014-03-17 251.931 -342.516
6 2002-01-01 2014-03-17 2014-03-17 245.219 -349.762
7 2003-01-01 2014-03-17 2014-03-17 255.984 -378.620
8 2004-01-01 2014-03-17 2014-03-17 290.931 -442.156
9 2005-01-01 2014-03-17 2014-03-17 322.065 -499.043
10 2006-01-01 2014-03-17 2014-03-17 365.198 -553.298
11 2007-01-01 2014-03-17 2014-03-17 413.215 -587.981
12 2008-01-01 2014-03-17 2014-03-17 460.083 -635.659
13 2009-01-01 2014-03-17 2014-03-17 394.547 -490.461
14 2010-01-01 2014-03-17 2014-03-17 461.117 -585.962
15 2011-01-01 2014-03-17 2014-03-17 528.206 -667.416