SASEFRED Interface Engine

Example 48.7 Specifying Two Series IDs with Multiple Vintage Dates and Descending Sort Order

(View the complete code for this example.)

This example demonstrates how to request the ADJRES and ADJRESN time series, which show the St. Louis adjusted reserves, the first of which is seasonally adjusted and the second of which is not seasonally adjusted. The request is made for three different vintage dates, but only 2006-08-31 and 2013-06-13 yield data when you use the range of START=’2004-01-01’and END=’2012-12-01’. If you specify OUTPUT=2, each time series is named by concatenating the series ID to the vintage date with an underscore. For brevity, Output 48.7.1 shows only the first 10 and last 10 observations. The sort order is descending; that is why the dates start with the most recent observation and continue in biweekly (ending Wednesday) periods to the least recent.


options validvarname=any;

title 'Specifying Two Series IDs with Multiple Vintage Dates and Descending Sort Order';
libname _all_ clear;
libname fred sasefred "%sysget(FRED)"
   OUTXML=fredex06
   AUTOMAP=replace
   MAPREF=MyMap
   XMLMAP="%sysget(FRED)fredex06.map"
   APIKEY='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
   IDLIST='ADJRES,ADJRESN'
   VINTAGE='2003-07-31,2006-08-31,2013-06-13'
   START='2004-01-01'
   END='2012-12-01'
   FREQ='bw'
   OUTPUT=2
   AGG='avg'
   SORT='desc'
   FORMAT=xml;

data fredPDD;
   set fred.fredex06;
run;
proc contents data=fredPDD; run;

%macro pri20nom(datname);
data lastob;
   set &datname nobs=last;
   last10=last-9;
   if last>20 then
      call symput('print10',last10);
   else
      call symput('print10',19);
run;
data getall20;
   set &datname(obs=10) &datname(firstobs=&print10);
run;
proc print data=getall20; run;
%mend pri20nom;

title3 "First 10/Last 10 Obs, IDLIST=ADJRES,ADJRESN, and SORT=Descending";
%pri20nom(fredPDD);

Output 48.7.1: Specifying Two Series IDs with Multiple Vintage Dates and Descending Sort Order—First 10 and Last 10 Observations

Specifying Two Series IDs with Multiple Vintage Dates and Descending Sort Order
 
First 10/Last 10 Obs, IDLIST=ADJRES,ADJRESN, and SORT=Descending

ObsdateADJRES_20130613ADJRES_20060831ADJRESN_20130613ADJRESN_20060831
12012-11-281591.92.1583.96.
22012-11-141583.90.1583.90.
32012-10-311573.04.1568.32.
42012-10-171563.23.1560.10.
52012-10-031511.02.1518.58.
62012-09-191587.55.1563.74.
72012-09-051583.80.1594.89.
82012-08-221618.63.1615.40.
92012-08-081652.49.1639.27.
102012-07-251620.07.1629.79.
112004-05-1295.8995.87194.7494.720
122004-04-2896.2596.15497.7997.693
132004-04-1493.3893.29393.3893.293
142004-03-3194.8194.71893.6793.582
152004-03-1794.2894.14693.9193.769
162004-03-0394.1394.09695.7395.696
172004-02-1892.0592.00193.2493.197
182004-02-0496.2596.19295.1095.038
192004-01-2196.5496.51197.6097.573
202004-01-0796.0696.044100.0099.982


Last updated: June 19, 2025