How to access Federal Reserve Economic Data (FRED) with SASEFRED in SAS/ETS® software

0

Photo by AbsolutVision on Unsplash

As a SAS user for most of my professional career and SAS employee for eight years, I thought I had a pretty good idea of what SAS offers and how SAS® Analytics can solve problems. Yet even I can experience an "aha" moment when I learn something new about SAS and I wish I had known before.

My most recent "aha" moment came a few months ago, right as the Covid-19 pandemic started to unfold. I learned about the SASEFRED interface engine, a component of SAS/ETS® software that allows you to retrieve a wide range of economic and financial data from the Federal Reserve Economic Data (FRED) site. Hosted by the Federal Reserve Bank of St. Louis, FRED is a treasure trove of about 765,000 US and international times series data reported at the national, state and county levels.

Being able to retrieve data from FRED directly into SAS has been extremely handy as I've developed interactive dashboards to capture key economic and financial indicators, such as unemployment claims, confidence sentiment, stock market index, volatility, etc. My SAS US Public Sector team's focus on this is part of a bigger effort to come alongside customers since the pandemic began. Our goal is to help all levels of government quickly set up analytical environments and provide timely situational awareness and analytical services. We're glad we're positioned to help public officials address public health and economic consequences of the pandemic.

How to get FRED data

SAS FRED documentation is self-explanatory. The first step is to obtain a unique FRED API key on the FRED site: https://api.stlouisfed.org/api_key.html. Once that’s done, you are off to the race.

Below is the snippet of the code that I used to pull unemployment data into SAS with SASEFRED.

options validvarname=any
   sslcalistloc="/opt/sas/viya/config/etc/SASSecurityCertificateFramework/cacerts/trustedcerts.pem";
 
libname _all_ clear;
libname mylib "/opt/sas/viya/config/data/cas/default/public"; /** Folder for final datasets **/
libname fred "/opt/sas/viya/config/data/cas/default/public/fred"; /** Folder for intermediate datasets **/
 
/** Ingest FRED Data **/
 
libname fred sasefred "/opt/sas/viya/config/data/cas/default/public/fred"
   OUTXML=UnemploymentClaims
   AUTOMAP=replace
   APIKEY='XXXXXXXXXXXXXXXXXXXX'  /** please request your API at this site https://api.stlouisfed.org/api_key.html **/
   IDLIST='ICSA,ICNSA,IC4WSA,CCSA,CCNSA'
   START='2008-01-01'
   END='2020-06-30'
   freq='w'
   ;
data mylib.UnemploymentClaims;
   set fred.UnemploymentClaims;
run;
proc print data=mylib.UnemploymentClaims;
run;

The output of the above code execution is the table ‘UnemploymentClaims’ with information on weekly reported initial unemployment claims, four-week moving average claims, and continued claims (see Figure 1 below).

Figure 1

An interactive dashboard with FRED data

The work was done on SAS® Viya, the next generation of SAS Analytics. SAS Viya offers a wide range of robust analytical capabilities, including visual data exploration and reporting. With data ingested into SAS Viya, I am now able to quickly develop an interactive economic dashboard with relevant indicators that will automatically update as the new economic data is reported – all thanks to SASEFRED (see image below).

Check the resources below to learn more. Hope you found this post relevant and useful. Feel free to reach out if you have any questions!

READ THE PAPER | Using SAS® Forecast Server and the SASEFRED Engine to Enhance Your Forecast WATCH THE VIDEO | Extracting a Common Time Trend in SAS/ETS
Tags learn sas
Share

About Author

Elena Shtern

Customer Advisor Lead

Elena Shtern is a Customer Advisor Lead for Federal Financial Regulators with SAS Public Sector. Her favorite part of her job is to build trust with her customers and provide strategic and tactical advice. Prior to joining SAS, Elena was a manager with PricewaterhouseCoopers LLC and was a Principal Economist on CoreLogic's R&D team. Throughout her career, Elena has used SAS technology extensively on a wide range of analytical projects, such as risk modeling, economic analysis, fraud analytics, litigation consulting, etc. Elena presented at two SAS Global User Forums and has an MBA degree with concentration in Finance from R.H. Smith School of Business, University of Maryland.

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to Top