SASEFRED Interface Engine

Example 48.11 Categories for a Specific Series with the URL= Option

(View the complete code for this example.)

The following statements demonstrate how to use the URL= option to obtain the CATEGORY and CATEGORIES data sets and how to create a permanent data set named SERIES_CAT7 in the MyLib SAS library:[18]


options validvarname=any;

title 'Specifying the URL= Option to Create the SERIES_CAT7 Data Set';
libname _all_ clear;
libname mylib "< path to your folder for data >";
libname fred7 sasefred "%sysget(FRED)" 
   debug=on
   URL="https://api.stlouisfed.org/fred/series/categories?series_id=EXJPUS"
   APIKEY='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
   IDLIST='EXJPUS'
   ;

data mylib.series_cat7;
   set fred7.XFREDtpu;
run;
proc print
   data=mylib.series_cat7;
run;

proc contents
   data=mylib.series_cat7;
run;

The returned data are stored in the XFREDTPU data set and are copied to the permanent data set named series_cat7.sas7bdat in the MyLib library. A side effect of the DATA step is the automatic creation of two SAS data sets, named category.sas7bdat and categories.sas7bdat, in the FRED7 library’s location. Two categories are returned for the specified series ID, as shown in Output 48.11.1.

Output 48.11.1: Specifying the URL= Option to Create the SERIES_CAT7 Data Set

Specifying the URL= Option to Create the SERIES_CAT7 Data Set

Obs categories_ORDINAL category_ORDINAL category_id category_name category_parent_id
1 1 1 95 Monthly Rates 15
2 1 2 275 Japan 158




[18] 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