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:
title 'Specifying the URL= Option to Create the SERIES_CAT7 Data Set'; libname _all_ clear; libname mylib "U:\fred940\doc\"; libname fred7 sasefred "U:\fred940\test\" debug=on URL="http://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.10.1.
Output 48.10.1: Specifying the URL= Option to Create the SERIES_CAT7 Data Set