The SASEFRED Interface Engine

Example 48.14 Releases Available for Today’s Date with the URL= Option

The following statements demonstrate how to use the URL= option to obtain the first 10 observations (LIMIT=10) of the REL3 data set for today’s date and how to create a permanent data set named REL3 in the MyLib SAS library:


title 'Specifying the URL= Option to Create the REL3 Data Set';
libname _all_ clear;
libname mylib "U:\fred940\doc\";

libname fred3 sasefred "U:\fred940\test\"
   debug=on
   URL="http://api.stlouisfed.org/fred/releases?limit=10"
   APIKEY='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
   ;

data mylib.rel3;
   set fred3.XFREDtpu;
run;
proc print
   data=mylib.rel3;
run;

proc contents
   data=mylib.rel3;
run;

The returned data are stored in the XFREDTPU data set and are copied to the permanent data set named rel3.sas7bdat in the MyLib library. A side effect of the DATA step is the automatic creation of two SAS data sets named release.sas7bdat and releases.sas7bdat in the FRED3 library’s location. More than 200 available releases could be returned for today, but the LIMIT=10 option obtains only the first 10 releases, as shown in Output 48.14.1.

Output 48.14.1: Specifying the URL= Option to Create the REL3 Data Set

Specifying the URL= Option to Create the REL3 Data Set

Obs releases_ORDINAL release_ORDINAL release_id release_realtime_start release_realtime_end release_name release_press_release release_link
1 1 1 9 2015-03-19 2015-03-19 Advance Monthly Sales for Retail and Food Services true http://www.census.gov/retail/
2 1 2 10 2015-03-19 2015-03-19 Consumer Price Index true http://www.bls.gov/cpi/
3 1 3 11 2015-03-19 2015-03-19 Employment Cost Index true http://www.bls.gov/ncs/ect/
4 1 4 13 2015-03-19 2015-03-19 G.17 Industrial Production and Capacity Utilization true http://www.federalreserve.gov/releases/g17/
5 1 5 14 2015-03-19 2015-03-19 G.19 Consumer Credit true http://www.federalreserve.gov/releases/g19/
6 1 6 15 2015-03-19 2015-03-19 G.5 Foreign Exchange Rates true http://www.federalreserve.gov/releases/g5/
7 1 7 17 2015-03-19 2015-03-19 H.10 Foreign Exchange Rates true http://www.federalreserve.gov/releases/h10/
8 1 8 18 2015-03-19 2015-03-19 H.15 Selected Interest Rates true http://www.federalreserve.gov/releases/h15/
9 1 9 19 2015-03-19 2015-03-19 H.3 Aggregate Reserves of Depository Institutions and the Monetary Base true http://www.federalreserve.gov/releases/h3/
10 1 10 20 2015-03-19 2015-03-19 H.4.1 Factors Affecting Reserve Balances true http://www.federalreserve.gov/releases/h41/