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;
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 |
| Obs | date | ADJRES_20130613 | ADJRES_20060831 | ADJRESN_20130613 | ADJRESN_20060831 |
|---|---|---|---|---|---|
| 1 | 2012-11-28 | 1591.92 | . | 1583.96 | . |
| 2 | 2012-11-14 | 1583.90 | . | 1583.90 | . |
| 3 | 2012-10-31 | 1573.04 | . | 1568.32 | . |
| 4 | 2012-10-17 | 1563.23 | . | 1560.10 | . |
| 5 | 2012-10-03 | 1511.02 | . | 1518.58 | . |
| 6 | 2012-09-19 | 1587.55 | . | 1563.74 | . |
| 7 | 2012-09-05 | 1583.80 | . | 1594.89 | . |
| 8 | 2012-08-22 | 1618.63 | . | 1615.40 | . |
| 9 | 2012-08-08 | 1652.49 | . | 1639.27 | . |
| 10 | 2012-07-25 | 1620.07 | . | 1629.79 | . |
| 11 | 2004-05-12 | 95.89 | 95.871 | 94.74 | 94.720 |
| 12 | 2004-04-28 | 96.25 | 96.154 | 97.79 | 97.693 |
| 13 | 2004-04-14 | 93.38 | 93.293 | 93.38 | 93.293 |
| 14 | 2004-03-31 | 94.81 | 94.718 | 93.67 | 93.582 |
| 15 | 2004-03-17 | 94.28 | 94.146 | 93.91 | 93.769 |
| 16 | 2004-03-03 | 94.13 | 94.096 | 95.73 | 95.696 |
| 17 | 2004-02-18 | 92.05 | 92.001 | 93.24 | 93.197 |
| 18 | 2004-02-04 | 96.25 | 96.192 | 95.10 | 95.038 |
| 19 | 2004-01-21 | 96.54 | 96.511 | 97.60 | 97.573 |
| 20 | 2004-01-07 | 96.06 | 96.044 | 100.00 | 99.982 |