Using FRED with Stata
In this blog, I will show you that if it is simple to use FRED data directly from STATA. The Federal Reserve Economic Data (FRED) is a database maintained by the Research division of the Federal Reserve Bank of St. Louis. As they described in their front page, you will be able to download, graph, and track 823,000 US and international time series from 114 sources.
Step number 1: First, you need to create an account on the FRED website: https://fred.stlouisfed.org/
Step number 2: Then, you have to request an API key into your account:
Step number 3: Once you have received the API key, you can move to STATA (my own API key is not shown):
You can use the following command to set the API key permanently in STATA (only once):
set fredkey key, permanently
Where the key is a series of 32 letters and numbers obtained from FRED in my case (not shown).
Step number 4: From here, you can use the FRED interface:
You can search exchange rate data for France with the FRED interface and select the real effective exchange rate for France coming from the Bank for the International Settlements (source):
Step number 4 bis: However, when you know the identifier, RBFRBIS, you can use the following command to import from FRED and plot the data for the real effective exchange rate of France (an increase indicates a real effective appreciation):
**#************ Import from FRED *******************************
import fred RBFRBIS
rename RBFRBIS reer_france
generate period = tm(1994m1) + _n-1
format %tm period
tsset period, monthly
twoway (tsline reer_france), ytitle("") ///
ttitle(Real effective exchange rate - France) tlabel(, grid) ///
legend(on position(2) ring(0))
**#*** The end of program **************************************
In four simple steps, you will be able to access, import and visualize data directly from the FRED database.
References
- Schenck, D. 2017. Importing data with import fred. The Stata Blog: Not Elsewhere Classified. https://blog.stata.com/2017/08/08/importing-data-with-import-fred/
About the author
I am a teacher and researcher in social sciences, specialized in several topics related to international economics. Sometimes, I write on Probability, Philosophy, Economics, and other topics with a macro perspective. My recent works explore the interactions between geopolitical tensions and the economy. More information on my personal website: https://www.jamelsaadaoui.com/