The following statements demonstrate how to use the URL= option to obtain the first 10 sources (LIMIT=10) for the SOURCES6 data set for today’s date and how to create a permanent data set named SOURCES6 in the MyLib SAS library:
title 'Specifying the URL= Option to Create the SOURCES6 Data Set'; libname _all_ clear; libname mylib "U:\fred940\doc\"; libname fred6 sasefred "U:\fred940\test\" debug=on URL="http://api.stlouisfed.org/fred/sources?limit=10" APIKEY='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' ; data mylib.sources6; set fred6.XFREDtpu; run;
proc print data=mylib.sources6; run; proc contents data=mylib.sources6; run;
The returned data are stored in the XFREDTPU
data set and are copied to the permanent data set named sources6.sas7bdat
in the MyLib library. A side effect of the DATA step is the automatic creation of two SAS data sets named source.sas7bdat
and sources.sas7bdat
in the FRED6 library’s location. Sixty-eight sources could be returned for today’s date, but the LIMIT=10 option obtains
only the first 10 sources, as shown in Output 48.13.1.
Output 48.13.1: Specifying the URL= Option to Create the SOURCES6 Data Set
Specifying the URL= Option to Create the SOURCES6 Data Set |
Obs | sources_ORDINAL | source_ORDINAL | source_id | source_realtime_start | source_realtime_end | source_name | source_link |
---|---|---|---|---|---|---|---|
1 | 1 | 1 | 1 | 2015-03-19 | 2015-03-19 | Board of Governors of the Federal Reserve System (US) | http://www.federalreserve.gov/ |
2 | 1 | 2 | 3 | 2015-03-19 | 2015-03-19 | Federal Reserve Bank of Philadelphia | http://www.philadelphiafed.org/ |
3 | 1 | 3 | 4 | 2015-03-19 | 2015-03-19 | Federal Reserve Bank of St. Louis | http://www.stlouisfed.org/ |
4 | 1 | 4 | 6 | 2015-03-19 | 2015-03-19 | Federal Financial Institutions Examination Council (US) | http://www.ffiec.gov/ |
5 | 1 | 5 | 11 | 2015-03-19 | 2015-03-19 | Dow Jones & Company | http://www.dowjones.com |
6 | 1 | 6 | 13 | 2015-03-19 | 2015-03-19 | Institute for Supply Management | http://www.ism.ws/ |
7 | 1 | 7 | 14 | 2015-03-19 | 2015-03-19 | Thomson Reuters/University of Michigan | https://customers.reuters.com/community/university/default.aspx |
8 | 1 | 8 | 15 | 2015-03-19 | 2015-03-19 | Council of Economic Advisers (US) | http://www.whitehouse.gov/cea/ |
9 | 1 | 9 | 16 | 2015-03-19 | 2015-03-19 | US. Office of Management and Budget | http://www.whitehouse.gov/omb/ |
10 | 1 | 10 | 17 | 2015-03-19 | 2015-03-19 | US. Congressional Budget Office | http://www.cbo.gov/ |