0% found this document useful (0 votes)
17 views

RATA Lecture Notes Download Financial Statements

This document provides instructions for downloading financial statements from Nasdaq.com using Stata. It explains that financial statements, including balance sheets, income statements, and cash flow statements are available for securities through various websites. The document then demonstrates how to use the fetch_statements command in Stata to download the most recent annual financial statements for all S&P 500 companies and store them in separate datasets for each statement type. Examples are given for downloading annual income statements, balance sheets, and cash flow statements.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

RATA Lecture Notes Download Financial Statements

This document provides instructions for downloading financial statements from Nasdaq.com using Stata. It explains that financial statements, including balance sheets, income statements, and cash flow statements are available for securities through various websites. The document then demonstrates how to use the fetch_statements command in Stata to download the most recent annual financial statements for all S&P 500 companies and store them in separate datasets for each statement type. Examples are given for downloading annual income statements, balance sheets, and cash flow statements.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Lecture Notes Download financial statements

What? Example
Financial statements are available for securities The following example will download the most re-
through several web sites including Yahoo! Finance, cent (2018 or 2017) annual income statements for all
Google and Nasdaq. These include, balance sheet, S&P-500 companies.
income statement and cash flow statement. Nas-
net install http://researchata.com/stata/010/fetchcomponents.pkg, force
daq.com, however, provides these financial state- fetchcomponents, symbol(^GSPC)
levelsof Symbol, local(symbols) clean
ments in a structured format which makes the down- foreach aa in `symbols' {
di "`aa'"
load process easy, fast and relatively reliable. These clear
capture: fetch_statements `aa', freq(a) st(IS)
financial statement are available for the current pe- if (_rc==0) {
if (_N>5) {
riod as well as for the past few periods (usually four qui: ds
local temp = word("`r(varlist)'",2)
quarters or four years). rename `temp' most_recent
keep item most_recent
Method gen symbol="`aa'"
capture: append using SP500_IS.dta
save SP500_IS.dta, replace
While we can download financial data to many of }
}
the spreadsheet software, we will be using Stata. }

fetch statements downloads financial statements


from Nasdaq.com. Example
Syntax and options The following example will download the most recent
fetch statements namelist(max=1), freq(string) (2018 or 2017) annual balance sheets for all S&P-500
st(string) companies.
• freq(): frequency of the financial statement filing. fetchcomponents, symbol(^GSPC)
levelsof Symbol, local(symbols) clean
It can be annual (a) or quarterly (q). foreach aa in `symbols' {
di "`aa'"
• st(): financial statement type. It can be income clear
capture: fetch_statements `aa', freq(a) st(BS)
statement (IS), balance sheet (BS) or cash flow if (_rc==0) {
if (_N>5) {
statement (CF). qui: ds
local temp = word("`r(varlist)'",2)
rename `temp' most_recent
Example keep item most_recent
gen symbol="`aa'"
capture: append using SP500_BS.dta
The following example will download the annual in- save SP500_BS.dta, replace
}
come statement for AAPL. }
}

net install http://researchata.com/stata/048/fetch_statements.pkg, force


fetch_statements AAPL, freq(a) st(IS)
Example
The following example will download the most re-
cent (2018 or 2017) annual cash flow statement for
all S&P-500 companies.
fetchcomponents, symbol(^GSPC)
levelsof Symbol, local(symbols) clean
foreach aa in `symbols' {
di "`aa'"
clear
capture: fetch_statements `aa', freq(a) st(CF)
if (_rc==0) {
if (_N>5) {
qui: ds
local temp = word("`r(varlist)'",2)
rename `temp' most_recent
keep item most_recent
Figure 1: Downloaded AAPL annual income state- gen symbol="`aa'"
capture: append using SP500_CF.dta
ment save SP500_CF.dta, replace
}
}
}

Mehmet F. Dicle, PhD

You might also like