SASEFRED Interface Engine

Example 48.9 Series for a Specific Release with the URL= Option

(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

Obsseriess_ORDINALseries_ORDINALseries_idseries_realtime_startseries_realtime_endseries_titleseries_observation_startseries_observation_endseries_frequencyseries_frequency_shortseries_unitsseries_units_shortseries_seasonal_adjustmentseries_seasonal_adjustment_shortseries_last_updatedseries_popularityseries_group_popularityseries_notes
111BOMTVLM133S2020-05-122020-05-12U.S. Imports of Services - Travel1992-01-012017-09-01MonthlyMMillion of DollarsMil. of $Seasonally AdjustedSA2017-11-03 08:12:15-0522Further 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
212BOMVGMM133S2020-05-122020-05-12U.S. Imports of Services: U.S. Government Miscellaneous Services (DISCONTINUED)1992-01-012013-12-01MonthlyMMillions of DollarsMil. of $Seasonally AdjustedSA2014-10-20 09:27:37-0511BEA has introduced new table presentations, including a new presentation of services, as part of a comprehensive restructuring of BEA’s international economic accounts.For more information see https://www.bea.gov/international/comprehensive-restructuring.
313BOMVJMM133S2020-05-122020-05-12U.S. Imports of Services - Direct Defense Expenditures (DISCONTINUED)1992-01-012013-12-01MonthlyMMillions of DollarsMil. of $Seasonally AdjustedSA2014-10-20 09:26:44-0511BEA has introduced new table presentations, including a new presentation of services, as part of a comprehensive restructuring of BEA’s international economic accounts.For more information see https://www.bea.gov/international/comprehensive-restructuring.
414BOMVMPM133S2020-05-122020-05-12U.S. Imports of Services - Passenger Fares1992-01-012017-09-01MonthlyMMillion of DollarsMil. of $Seasonally AdjustedSA2017-11-03 08:12:15-0511Further 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
515BOMVOMM133S2020-05-122020-05-12U.S. Imports of Services - Other Private Services (DISCONTINUED)1992-01-012013-12-01MonthlyMMillion of DollarsMil. of $Seasonally AdjustedSA2014-10-20 09:25:54-0511BEA has introduced new table presentations, including a new presentation of services, as part of a comprehensive restructuring of BEA’s international economic accounts.For more information see https://www.bea.gov/international/comprehensive-restructuring.
61556ITXMARM133S2020-05-122020-05-12U.S. Exports of Services: Maintenance and Repair Services, not included elsewhere1999-01-012020-03-01MonthlyMMillions of DollarsMil. of $Seasonally AdjustedSA2020-05-05 07:52:17-0522Further 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
71557ITXOBSM133S2020-05-122020-05-12U.S. Exports of Services: Other Business Services1999-01-012020-03-01MonthlyMMillions of DollarsMil. of $Seasonally AdjustedSA2020-05-05 07:52:18-0511Further 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
81558ITXTAEM133S2020-05-122020-05-12U.S. Exports of Services: Travel (for All Purposes Including Education)1999-01-012020-03-01MonthlyMMillions of DollarsMil. of $Seasonally AdjustedSA2020-05-05 07:51:07-0577Further 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
91559ITXTCIM133S2020-05-122020-05-12U.S. Exports of Services: Telecommunications, Computer, and Information Services1999-01-012020-03-01MonthlyMMillions of DollarsMil. of $Seasonally AdjustedSA2020-05-05 07:52:17-0522Further 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
101560ITXTRAM133S2020-05-122020-05-12U.S. Exports of Services: Transport1999-01-012020-03-01MonthlyMMillions of DollarsMil. of $Seasonally AdjustedSA2020-05-05 07:51:08-0511Further 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.

Last updated: June 19, 2025