The SASEFRED Interface Engine

Example 48.7 Vintage Dates for a Specific Series with the URL= Option

The following statements demonstrate how to use the URL= option to obtain the VINTAGE_DATE and VINTAGE_DATES data sets for a specified series and how to create a permanent data set named VINDAT1 in the MyLib SAS library. You must specify the series in both the URL= option and the IDLIST= option.


title 'Specifying the URL= Option to Create the VINTAGE_DATES Data Set';
libname _all_ clear;

libname mylib "U:\fred940\doc\";

libname fred1 sasefred "%sysget(FRED)"
   URL="http://api.stlouisfed.org/fred/series/vintagedates?series_id=N5005C1A027NBEA"
   APIKEY='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
   IDLIST= 'N5005C1A027NBEA'
   ;

data mylib.vindat1;
   set fred1.XFREDtpu;
run;
proc print
   data=mylib.vindat1;
run;

proc contents
   data=mylib.vindat1;
run;

The list of available vintage dates for the N5005C1A027NBEA series is read from the XFREDtpu.xml file that is downloaded by the SASEFRED engine. The contents are shown in Output 48.7.1. The engine automatically maps the data in the XML file and reads the data into the XFREDTPU data set when the SET statement is executed. When the DATA step runs, the data in the temporary utility data set are read and stored in the permanent data set named vindat1.sas7bdat in the MyLib library. A side effect of the DATA step is the automatic creation of two SAS data sets named vintage_date.sas7bdat and vintage_dates.sas7bdat in the FRED1 library’s location.

Output 48.7.1: Specifying the URL= Option to Create the VINTAGE_DATES Data Set

Specifying the URL= Option to Create the VINTAGE_DATES Data Set

Obs vintage_dates_ORDINAL vintage_date_ORDINAL vintage_date
1 1 1 2013-02-28
2 1 2 2013-03-28
3 1 3 2013-05-30
4 1 4 2013-07-31
5 1 5 2014-03-27
6 1 6 2014-05-29
7 1 7 2014-07-30