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