The following statements demonstrate how to use the URL= option to obtain the SERIES and SERIESS data sets for specified tag names and how to create a permanent data set named TAGS_SERIES4 in the MyLib SAS library:
title 'Specifying the URL= Option to Create the TAGS_SERIES4 Data Set.'; libname _all_ clear; libname mylib "U:\fred940\doc\"; libname fred4 sasefred "U:\fred940\test\" debug=on URL="http://api.stlouisfed.org/fred/tags/series?tag_names=slovenia;food;oecd" APIKEY='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' ; data mylib.tags_series4; set fred4.XFREDtpu; run;
proc print data=mylib.tags_series4(obs=2); run; proc contents data=mylib.tags_series4; run;
The returned data are stored in the XFREDTPU
data set and are copied to the permanent data set named tags_series4.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 FRED4 library’s location. Eighteen series are returned for the specified tag names; the OBS=2 option in the DATA statement
in the PROC PRINT step prints only two of them. Output 48.9.1 shows the first two observations of the TAGS_SERIES4 data set.
Output 48.9.1: Specifying the URL= Option to Create the TAGS_SERIES4 Data Set
Specifying the URL= Option to Create the TAGS_SERIES4 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_notes |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | 1 | CPGDFD02SIA657N | 2015-03-19 | 2015-03-19 | Consumer Price Index: Total Food Excluding Restaurants for Slovenia© | 1996-01-01 | 2014-01-01 | Annual | A | Growth Rate Previous Period | Growth Rate Previous Period | Not Seasonally Adjusted | NSA | 2015-02-03 15:27:27-06 | 0 | OECD descriptor ID: CPGDFD02 OECD unit ID: GP OECD country ID: SVN All OECD data should be cited as follows: OECD, "Main Economic Indicators - complete database", Main Economic Indicators (database),http://dx.doi.org/10.1787/data-00052-en (Accessed on date) Copyright, 2014, OECD. Reprinted with permission. |
2 | 1 | 2 | CPGDFD02SIA659N | 2015-03-19 | 2015-03-19 | Consumer Price Index: Total Food Excluding Restaurants for Slovenia© | 1996-01-01 | 2014-01-01 | Annual | A | Growth Rate Same Period Previous Year | Growth Rate Same Period Previous Yr. | Not Seasonally Adjusted | NSA | 2015-02-03 15:27:27-06 | 0 | OECD descriptor ID: CPGDFD02 OECD unit ID: GY OECD country ID: SVN All OECD data should be cited as follows: OECD, "Main Economic Indicators - complete database", Main Economic Indicators (database),http://dx.doi.org/10.1787/data-00052-en (Accessed on date) Copyright, 2014, OECD. Reprinted with permission. |