(View the complete code for this example.)
The following statements demonstrate how to use the URL= option to obtain the SERIES and SERIESS data sets for a specified release and how to create a permanent data set named SERIES2 in the MyLib SAS library:[16]
options validvarname=any;
title 'Specifying the URL= Option to Create the SERIES Data Set';
libname _all_ clear;
libname fred2 sasefred "%sysget(FRED)"
URL="https://api.stlouisfed.org/fred/release/series?release_id=51"
APIKEY='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
;
data series2;
set fred2.XFREDtpu;
run;
proc contents
data=series2;
run;
%macro pri10nom(datname);
data lastob;
set &datname nobs=last;
last5=last-4;
if last>10 then
call symput('print5',last5);
else
call symput('print5',9);
run;
data getall10;
set &datname(obs=5) &datname(firstobs=&print5);
run;
proc print data=getall10; run;
%mend pri10nom;
title3 "First 5/Last 5 Obs, SERIES2 Data Set";
%pri10nom(series2);
The returned data are stored in the XFREDTPU data set and are copied to the permanent data set named series2.sas7bdat in the MyLib library. A side effect of the DATA step is the automatic creation of two SAS data sets, named series.sas7bdat and seriess.sas7bdat, in the FRED2 library’s location. Many series are returned for release_id=51; Output 48.9.1 shows only the first and last five observations of the SERIES data set.
Output 48.9.1: Specifying the URL= Option to Create the SERIES Data Set—First 5 and Last 5 Observations
| Specifying the URL= Option to Create the SERIES Data Set |
| First 5/Last 5 Obs, SERIES2 Data Set |
| Obs | seriess_ORDINAL | series_ORDINAL | series_id | series_realtime_start | series_realtime_end | series_title | series_observation_start | series_observation_end | series_frequency | series_frequency_short | series_units | series_units_short | series_seasonal_adjustment | series_seasonal_adjustment_short | series_last_updated | series_popularity | series_group_popularity | series_notes |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 1 | BOMTVLM133S | 2020-05-12 | 2020-05-12 | U.S. Imports of Services - Travel | 1992-01-01 | 2017-09-01 | Monthly | M | Million of Dollars | Mil. of $ | Seasonally Adjusted | SA | 2017-11-03 08:12:15-05 | 2 | 2 | Further information related to the international trade data can be found at https://www.census.gov/foreign-trade/data/index.html Methodology details can be found at https://www.census.gov/foreign-trade/Press-Release/current_press_release/explain.pdf |
| 2 | 1 | 2 | BOMVGMM133S | 2020-05-12 | 2020-05-12 | U.S. Imports of Services: U.S. Government Miscellaneous Services (DISCONTINUED) | 1992-01-01 | 2013-12-01 | Monthly | M | Millions of Dollars | Mil. of $ | Seasonally Adjusted | SA | 2014-10-20 09:27:37-05 | 1 | 1 | BEA has introduced new table presentations, including a new presentation of services, as part of a comprehensive restructuring of BEAs international economic accounts.For more information see https://www.bea.gov/international/comprehensive-restructuring. |
| 3 | 1 | 3 | BOMVJMM133S | 2020-05-12 | 2020-05-12 | U.S. Imports of Services - Direct Defense Expenditures (DISCONTINUED) | 1992-01-01 | 2013-12-01 | Monthly | M | Millions of Dollars | Mil. of $ | Seasonally Adjusted | SA | 2014-10-20 09:26:44-05 | 1 | 1 | BEA has introduced new table presentations, including a new presentation of services, as part of a comprehensive restructuring of BEAs international economic accounts.For more information see https://www.bea.gov/international/comprehensive-restructuring. |
| 4 | 1 | 4 | BOMVMPM133S | 2020-05-12 | 2020-05-12 | U.S. Imports of Services - Passenger Fares | 1992-01-01 | 2017-09-01 | Monthly | M | Million of Dollars | Mil. of $ | Seasonally Adjusted | SA | 2017-11-03 08:12:15-05 | 1 | 1 | Further information related to the international trade data can be found at https://www.census.gov/foreign-trade/data/index.html Methodology details can be found at https://www.census.gov/foreign-trade/Press-Release/current_press_release/explain.pdf |
| 5 | 1 | 5 | BOMVOMM133S | 2020-05-12 | 2020-05-12 | U.S. Imports of Services - Other Private Services (DISCONTINUED) | 1992-01-01 | 2013-12-01 | Monthly | M | Million of Dollars | Mil. of $ | Seasonally Adjusted | SA | 2014-10-20 09:25:54-05 | 1 | 1 | BEA has introduced new table presentations, including a new presentation of services, as part of a comprehensive restructuring of BEAs international economic accounts.For more information see https://www.bea.gov/international/comprehensive-restructuring. |
| 6 | 1 | 556 | ITXMARM133S | 2020-05-12 | 2020-05-12 | U.S. Exports of Services: Maintenance and Repair Services, not included elsewhere | 1999-01-01 | 2020-03-01 | Monthly | M | Millions of Dollars | Mil. of $ | Seasonally Adjusted | SA | 2020-05-05 07:52:17-05 | 2 | 2 | Further information related to the international trade data can be found at https://www.census.gov/foreign-trade/data/index.html Methodology details can be found at https://www.census.gov/foreign-trade/Press-Release/current_press_release/explain.pdf |
| 7 | 1 | 557 | ITXOBSM133S | 2020-05-12 | 2020-05-12 | U.S. Exports of Services: Other Business Services | 1999-01-01 | 2020-03-01 | Monthly | M | Millions of Dollars | Mil. of $ | Seasonally Adjusted | SA | 2020-05-05 07:52:18-05 | 1 | 1 | Further information related to the international trade data can be found at https://www.census.gov/foreign-trade/data/index.html Methodology details can be found at https://www.census.gov/foreign-trade/Press-Release/current_press_release/explain.pdf |
| 8 | 1 | 558 | ITXTAEM133S | 2020-05-12 | 2020-05-12 | U.S. Exports of Services: Travel (for All Purposes Including Education) | 1999-01-01 | 2020-03-01 | Monthly | M | Millions of Dollars | Mil. of $ | Seasonally Adjusted | SA | 2020-05-05 07:51:07-05 | 7 | 7 | Further information related to the international trade data can be found at https://www.census.gov/foreign-trade/data/index.html Methodology details can be found at https://www.census.gov/foreign-trade/Press-Release/current_press_release/explain.pdf |
| 9 | 1 | 559 | ITXTCIM133S | 2020-05-12 | 2020-05-12 | U.S. Exports of Services: Telecommunications, Computer, and Information Services | 1999-01-01 | 2020-03-01 | Monthly | M | Millions of Dollars | Mil. of $ | Seasonally Adjusted | SA | 2020-05-05 07:52:17-05 | 2 | 2 | Further information related to the international trade data can be found at https://www.census.gov/foreign-trade/data/index.html Methodology details can be found at https://www.census.gov/foreign-trade/Press-Release/current_press_release/explain.pdf |
| 10 | 1 | 560 | ITXTRAM133S | 2020-05-12 | 2020-05-12 | U.S. Exports of Services: Transport | 1999-01-01 | 2020-03-01 | Monthly | M | Millions of Dollars | Mil. of $ | Seasonally Adjusted | SA | 2020-05-05 07:51:08-05 | 1 | 1 | Further information related to the international trade data can be found at https://www.census.gov/foreign-trade/data/index.html Methodology details can be found at https://www.census.gov/foreign-trade/Press-Release/current_press_release/explain.pdf |
[16] Disclaimer: SAS may reference other websites or content or resources for use at Customer's sole discretion. SAS has no control over any websites or resources that are provided by companies or persons other than SAS. Customer acknowledges and agrees that SAS is not responsible for the availability or use of any such external sites or resources, and does not endorse any advertising, products, or other materials on or available from such websites or resources. Customer acknowledges and agrees that SAS is not liable for any loss or damage that may be incurred by Customer or its end users as a result of the availability or use of those external sites or resources, or as a result of any reliance placed by Customer or its end users on the completeness, accuracy, or existence of any advertising, products, or other materials on, or available from, such websites or resources.