.chapter15<-function(i=0){ " i Chapter 15: Financial Statement Analysis i Explanations - ------------------------------------- -- ------------------------------- 1 Errata for chapter (book) 21c Getting: ibmBS.RData 2 Purposes of a fin statement analysis 22c ibmIS.RData 3 A simple balance sheet 23c ibmCF.RData 4 A simple income statement 24c Ratio Calculations: current 5 Formula to generate cash flows 25c : ROE/ROA 6 Manually download BS,IS, and CF 26c : divided by a vector 7 Balance Sheets/Income Statements 27c : DuPont Identity 8 Cash flow Statement 28c : Common-size 9 Quarterly Balance Sheets 29 SEC filings (index) 10 CIK (Central Index Key) 30 : filing examples 11 Access to SEC filings 31 : CIK linked to Ticker 12 Common-size financial statements 32c : tickerCIK.RData 13 Purpose of a ratio analysis 33 : Financial Statement Data Sets 14 Several frequently used ratios 34 : 2024q2 as an example 15 A list of accounting ratios 35 : 4 text files 16 DuPont identity 36 : explanation 15 How to find competitors' industry ratios 37c : bs2024q2.RData 18 Multiples and stock evaluation 38c : is2024q2.RData 19 A good way to save a financial statement 39c : cf2024q2.RData 20 Links 40c : generate BS,IS,CF 2024q2 Example #1:> .c15 # find out the list Example #2:> .c15() # the same as the above Example #3:> .c15(1) # see the first explanation ";.zchapter15(i)} .n15chapter<-40 .zchapter15<-function(i){ if(i==0){ print(.c15) }else{ .printEachQ(15,i,.n15chapter) } } .c15<-.chapter15 .C15EXPLAIN1<-"Errata for the chapter (book) ////////////////////////// For chapter 4, 'Financial Modeling using R' (2018) , the R package called 'quantmod' is used to download various financial statements. To be more specific, functions getFin(), getFinancials() and getSymbol.goole. However, since Google Finance has changed their dat structure, those related funcitons stop working. library(quantmod) help(\"quantmod-defunct\") ///////////////////////////////////////////////////////// Description The functions listed here are no longer part of quantmod. Usage # Defunct in 0.4-13 getFin(Symbol, env = parent.frame(), src = \"google\", auto.assign = TRUE, ...) getFinancials(Symbol, env = parent.frame(), src =\"google\", auto.assign = TRUE, ...) getSymbols.google(Symbols, env, return.class = \"xts\", from = \"2007-01-01\", to = Sys.Date(), ...) Details Google Finance stopped providing data in March, 2018. This included historical price data, and also financial information. This affected getFinancials, getFin, and getSymbols.google. ////////////////////////// " .C15EXPLAIN2<-"Purposes of a financial statement analysis ////////////////////////// Objective #1: compare with company itself look at various ratios to see improvements check performance and weakness Objective #2: compare with peers in the same industry ////////////////////////// " .C15EXPLAIN3<-"A simple balance sheet ////////////////////////// A balance-sheet is snapshot for a company, usually a quarter one or an annual one. Example Cash = 0.2m Equipment = 0.5m Other values= 0.3m ------------------- Total assets= 1.0m Short-term debt = 0.1m Long-term debt = 0.3m Equity = 0.6m --------------------- Total assets = 1.0m ////////////////////////// " .C15EXPLAIN4<-"A simple income statement ////////////////////////// Basic format Revenue - Cost - Interest payment ---------------- EBT - Tax --------------- = Net Income Example ---------------------------------- Revenue = 100 Cost = - 50 Interest payment = - 10 ----------------------------- EBT = 40 Tax rate is 0.34 = -13.6 -------------------------------- Net Income = 26.4 ////////////////////////// " .C15EXPLAIN5<-"A simple cash flow statement ////////////////////////// Free Cash Flow = NI + Depreciation - change in CapEx + change in NWC NI is Net Income depreciation is depreciation of the year change in CapEx is change in capital expenditure change in NWC is change in Net working capital NWC is net working capital defined as CA -CL CA is the current asset CL is the current liability ////////////////////////// " .C15EXPLAIN6<-"manually download latest several years' financial statements (BS,IS,CF) ////////////////////////// Step 1: go to http://finance.yahoo.com Step 2: enter a ticker, e.g., \"ibm\" Step 3: click \"Financials\" Step 4: choose Balance Sheet, Income statement or Cash flow Step 5: choose annual or quarterly ////////////////////////// " .C15EXPLAIN7<-"download and save several years' Balance Sheets ////////////////////////// You can use a function called .getBSannual() Type getBSannua to find its usage >.getBSannual Example #1 >x=.getBSannual(\"ibm\") Annual Balance Sheet for ibm > .saveFinStatement(x,\"c:/temp/ibmBS.csv\") [1] \"Your saved file is ==>c:/temp/ibmBS.csv\" download and save several years' Income Statements -------------------------------------------------- You can use an function called .getISannual() Type .getISannua to find its usage >.getISannual Example #1 >x=.getISannual(\"ibm\") ////////////////////////// " .C15EXPLAIN8<-"download and save several years' Cash flow Statement ////////////////////////// >.getdata # get a list of all related functions >.getBSannual # find info >x=.getBSannual(\"ibm\") # get IBM's balance sheets ////////////////////////// " .C15EXPLAIN9<-"An easy way to download and save BS, IS and Cash Flow statements ////////////////////////// See all function -------------- >.getdata # get a list of all related functions Balance sheet ------------ >.getBSquarterly # find info >x=.getBSquarterly(\"ibm\") # get IBM's balance sheets Balance sheet ------------ >.getISquarterly # find info >x=.getISquarterly(\"ibm\") # get IBM's income statements Balance sheet ------------ >.getCFquarterly # find info >x=.getCFquarterly(\"ibm\") # get IBM's cash flow statements ////////////////////////// " .C15EXPLAIN10<-"Central Index Key (CIK) ////////////////////////// The CIK is the unique numerical identifier assigned by the EDGAR system to filers when they sign up to make filings to the SEC. CIK numbers remain unique to the filer; they are not recycled. CIK-ticker mapping http://rankandfiled.com/#/data/tickers ////////////////////////// " .C15EXPLAIN11<-"Access to SEC filings ////////////////////////// https://www.sec.gov/edgar/searchedgar/accessing-edgar-data.htm Given CIK, e.g., CIK=51143 https://www.sec.gov/Archives/edgar/data/51143/ https://www.sec.gov/Archives/edgar/data/51143/000104746917001061/ ////////////////////////// " .C15EXPLAIN12<-"Common-size financial statements ////////////////////////// To compare the performance of a firm over several years or compare its performance with other firms in the same industry, we use so-called common size financial statements. For example, last year's Cash & Equivalents was $1m and this year's corresponding value is $1.1m. With those two values alone, it is difficult to figure out what the impact of this specific data item. If we know further that the ratio of this data item over total sales are a constant over two years, then it is easier to interpret our results. original data New Data Item= ----------------------- Reference data For a balance-sheet original data New Data Item= ----------------------- Total asset For an income statement: original data New Data Item= ----------------------- Total Sales ////////////////////////// " .C15EXPLAIN13<-"What is the purpose for a ratio analysis ////////////////////////// Objective #1: compare with company itself look at various ratios to see improvements check performance and weakness Objective #2: compare with peers in the same industry ////////////////////////// " .C15EXPLAIN14<-"several frequently used ratios ////////////////////////// Short-term liquidity -------------------- CA current ratio = ---------------- CL CA: current asset CL: current liability CA - inventory quick ratio = ---------- CL Cash + short-term securities cash ratio == --------------------------- CL leverage ratios -------------------- D Debt to Total assets = --- A LT debt long-term debt to total asset= ----- A D Debt to equity ratio = ---- E Probability -------------------- NI ROA = --- A NI ROE = --- E ////////////////////////// " .C15EXPLAIN15<-"A list of accounting ratios ////////////////////////// Profitability Ratios -------------------- Gross Profit Rate = Gross Profit / Net Sales Evaluates how much gross profit is generated from sales. Gross profit is equal to net sales (sales minus sales returns, discounts, and allowances) minus cost of sales. Return on Sales = Net Income / Net Sales Also known as \"net profit margin\" or \"net profit rate\", it measures the percentage of income derived from dollar sales. Generally, the higher the ROS the better. Return on Assets = Net Income / Average Total Assets In financial analysis, it is the measure of the return on investment. ROA is used in evaluating management's efficiency in using assets to generate income. Return on Stockholders' Equity = Net Income / Average Stockholders' Equity Measures the percentage of income derived for every dollar of owners' equity. Liquidity Ratios -------------------- Current Ratio = Current Assets / Current Liabilities Evaluates the ability of a company to pay short-term obligations using current assets (cash, marketable securities, current receivables, inventory, and prepayments). Acid Test Ratio = Quick Assets / Current Liabilities Also known as \"quick ratio\", it measures the ability of a company to pay short-term obligations using the more liquid types of current assets or \"quick assets\" (cash, marketable securities, and current receivables). Cash Ratio = ( Cash + Marketable Securities ) / Current Liabilities Measures the ability of a company to pay its current liabilities using cash and marketable securities. Marketable securities are short-term debt instruments that are as good as cash. Net Working Capital = Current Assets - Current Liabilities Determines if a company can meet its current obligations with its current assets; and how much excess or deficiency there is. Management Efficiency Ratios -------------------- Receivable Turnover = Net Credit Sales / Average Accounts Receivable Measures the efficiency of extending credit and collecting the same. It indicates the average number of times in a year a company collects its open accounts. A high ratio implies efficient credit and collection process. Days Sales Outstanding = 360 Days / Receivable Turnover Also known as \"receivable turnover in days\", \"collection period\". It measures the average number of days it takes a company to collect a receivable. The shorter the DSO, the better. Take note that some use 365 days instead of 360. Inventory Turnover = Cost of Sales / Average Inventory Represents the number of times inventory is sold and replaced. Take note that some authors use Sales in lieu of Cost of Sales in the above formula. A high ratio indicates that the company is efficient in managing its inventories. Days Inventory Outstanding = 360 Days / Inventory Turnover Also known as \"inventory turnover in days\". It represents the number of days inventory sits in the warehouse. In other words, it measures the number of days from purchase of inventory to the sale of the same. Like DSO, the shorter the DIO the better. Accounts Payable Turnover = Net Credit Purchases / Ave. Accounts Payable Represents the number of times a company pays its accounts payable during a period. A low ratio is favored because it is better to delay payments as much as possible so that the money can be used for more productive purposes. Days Payable Outstanding = 360 Days / Accounts Payable Turnover Also known as \"accounts payable turnover in days\", \"payment period\". It measures the average number of days spent before paying obligations to suppliers. Unlike DSO and DIO, the longer the DPO the better (as explained above). Operating Cycle = Days Inventory Outstanding + Days Sales Outstanding Measures the number of days a company makes 1 complete operating cycle, i.e. purchase merchandise, sell them, and collect the amount due. A shorter operating cycle means that the company generates sales and collects cash faster. Cash Conversion Cycle = Operating Cycle - Days Payable Outstanding CCC measures how fast a company converts cash into more cash. It represents the number of days a company pays for purchases, sells them, and collects the amount due. Generally, like operating cycle, the shorter the CCC the better. Total Asset Turnover = Net Sales / Average Total Assets Measures overall efficiency of a company in generating sales using its assets. The formula is like ROA, except that net sales is used instead of net income. Leverage Ratios -------------------- Debt Ratio = Total Liabilities / Total Assets Measures the portion of company assets that is financed by debt (Obligations to third parties). Debt ratio can also be computed using the formula: 1 minus Equity Ratio. Equity Ratio = Total Equity / Total Assets Determines the portion of total assets provided by equity (i.e. owners' contributions and the company's accumulated profits). Equity ratio can also be computed using the formula: 1 minus Debt Ratio. The reciprocal of equity ratio is known as equity multiplier, which is equal to total assets divided by total equity. Debt-Equity Ratio = Total Liabilities / Total Equity Evaluates the capital structure of a company. A D/E ratio of more than 1 implies that the company is a leveraged firm; less than 1 implies that it is a conservative one. Times Interest Earned = EBIT / Interest Expense Measures the number of times interest expense is converted to income, and if the company can pay its interest expense using the profits generated. EBIT is earnings before interest and taxes. Valuation and Growth Ratios -------------------- Earnings per Share = ( Net Income - Preferred Dividends ) / Average Common Shares Outstanding EPS shows the rate of earnings per share of common stock. Preferred dividends is deducted from net income to get the earnings available to common stockholders. Price-Earnings Ratio = Market Price per Share / Earnings per Share Used to evaluate if a stock is over- or underpriced. A relatively low P/E ratio could indicate that the company is underpriced. Conversely, investors expect high growth rate from companies with high P/E ratio. Dividend Pay-out Ratio = Dividend per Share / Earnings per Share Determines the portion of net income that is distributed to owners. Not all income is distributed since a significant portion is retained for the next year's operations. Dividend Yield Ratio = Dividend per Share / Market Price per Share Measures the percentage of return through dividends when compared to the price paid for the stock. A high yield is attractive to investors who are after dividends rather than long-term capital appreciation. Book Value per Share = Common SHE / Average Common Shares Indicates the value of stock based on historical cost. The value of common shareholders' equity in the books of the company is divided by the average common shares outstanding. Source: http://www.accountingverse.com/managerial-accounting/fs-analysis/financial-ratios.html ////////////////////////// " .C15EXPLAIN16<-"DuPont identity ////////////////////////// Net Income ROE is defined as = ---------------- Equity NI ROE= --- (1) E Let times equation (1) by Sales and divide sales NI Sales ROE= --- * --- (2) E sales Let times equation (2) by total assets and divide it by the same value NI S A ROE= --- * --- * --- (3) E s A Now, let's reorganize terms NI S A ROE= --- * --- * --- (4) S A E ROE=(net income/sales)*(sales/total assets)*(total assets/equity) ROE = Net Profit Margin * Asset Turnover * Equity Multiplier ////////////////////////// " .C15EXPLAIN17<-"How to find competitors and industry ratios ////////////////////////// current price PE ratio = ------------ EPS EPS is the earnings per share ////////////////////////// " .C15EXPLAIN18<-"multiples and stock evaluation ////////////////////////// Many multiples, such as PE ratio, could be used to evaluation a stock's performance. ////////////////////////// " .C15EXPLAIN19<-"An easy way to save a fin statement /////////////////////////////// x<-.getBSannual('ibm') .saveFinStatement(x,\"c:/temp/ibm.csv\") ///////////////////////////////// " .C15EXPLAIN20<-"Links /////////////////////////////// Yahoo!Finance : http://finance.yahoo.com/ Google finance: https://www.google.com/finance Market Watch : http://www.marketwatch.com SEC filings : https://www.sec.gov/edgar.shtml Compustat : https://en.wikipedia.org/wiki/Compustat Financial ratios http://www.accountingverse.com/managerial-accounting/fs-analysis/financial-ratios.html 6 Basic Financial Ratios And What They Reveal (YouTube,2m3s) http://www.investopedia.com/financial-edge/0910/6-basic-financial-ratios-and-what-they-tell-you.aspx Cash Flow statements http://harbert.auburn.edu/~colqull/FINC3610/Chap9notes.pdf Understanding the COMPUSTAT (North America) Database http://web.utk.edu/~prdaves/Computerhelp/COMPUSTAT/Compustat_manuals/user_02.pdf ///////////////////////////////// " .C15EXPLAIN21<-"Getting ibmBS.RData /////////////////////////////// infile<-'http://datayyy.com/data_R/ibmBS.RData' a<-load(url(infile)) print(a) # [1] .x dim(.x) # [1] 95 5 ///////////////////////////////// " .C15EXPLAIN22<-"ibmIS.RData /////////////////////////////// infile<-'http://datayyy.com/data_R/ibmIS.RData' a<-load(url(infile)) print(a) # [1] .x dim(.x) # [1] 32 6 ///////////////////////////////// " .C15EXPLAIN23<-"Getting the ibmCF.RData data set /////////////////////////////// infile<-'http://datayyy.com/data_R/ibmCF.RData' a<-load(url(infile)) print(a) # [1] .x dim(.x) # [1] 11 6 ///////////////////////////////// " .C15EXPLAIN24<-"Current Ratio /////////////////////////////// infile<-\"http://datayyy.com/data_R/ibmBS.RData\" a<-load(url(infile)) print(a) dim(.x) head(.x) a<-\"^current a\" CA<-.x[grep(toupper(a),toupper(rownames(.x))),] a<-\"^current l\" CL<-.x[grep(toupper(a),toupper(rownames(.x))),] currentRatio<-CA[1,]/CL print(currentRatio) > CA 2023 2022 2021 2020 Current Assets 32908000 29118000 29539000 39165000 Current Accrued Expenses 3521000 4111000 3892000 5632000 > CL 2023 2022 2021 2020 Current Liabilities 34122000 31505000 33619000 39869000 > print(currentRatio) 2023 2022 2021 2020 Current Assets 0.9644218 0.9242342 0.8786401 0.9823422 ///////////////////////////////// " .C15EXPLAIN25<-"ROA and ROE /////////////////////////////// infile<-\"http://datayyy.com/data_R/ibmBS.RData\" a<-load(url(infile)) print(a) BS<-.x infile<-\"http://datayyy.com/data_R/ibmIS.RData\" a<-load(url(infile)) print(a) IS<-.x namesIS<- toupper(rownames(IS)) namesBS<-toupper(rownames(BS)) p<-\"net income\" netIncome<-IS[grep(toupper(p),namesIS),] print(netIncome) p<-\"Common Stock equity\" equity<-BS[grep(toupper(p),namesBS),] print(equity) netIncome2<-as.numeric(netIncome[1,]) equity2<-as.numeric(equity) ROE<-netIncome2/equity2 print(\" ---- ROE ---------------\") print(ROE) # TA<- toupper(\"Total Assets\") totalAssets<-BS[grep(TA,namesBS),] totalAssets print(\" ---- ROA ---------------\") ROA<-netIncome[,1]/totalAssets print(ROA) ///////////////////////////////// " .C15EXPLAIN26<-" /////////////////////////////// # objective: we have two vectors with dimensions of 1 8 5 # we plan vector dived by vector v1<-c(1,2,2,3,4) v2<-c(1,2,2,3,8) v1/v2 # [1] 1.0 1.0 1.0 1.0 0.5 # columns divided by vector -------------------------------------- a<-matrix(rep(5,5*3),5,3) b <- c(1, 2, 5) # x <- as.matrix(a) v <- as.numeric(b) result <- sweep(x,2,v, FUN = \"/\") # print(x) print(v) print(result) ///////////////////////////////// " .C15EXPLAIN27<-" /////////////////////////////// infile<-\"http://datayyy.com/data_R/ibmBS.RData\" a<-load(url(infile)) print(a) BS<-.x infile<-\"http://datayyy.com/data_R/ibmIS.RData\" a<-load(url(infile)) print(a) IS<-.x head(BS,2) head(IS,2) ///////////////////////////////// " .C15EXPLAIN28<-"Common-size Balance Sheet /////////////////////////////// infile<-\"http://datayyy.com/data_R/ibmBS.RData\" a<-load(url(infile)) print(a) head(.x) item<-\"total assets\" TA<-.x[toupper(rownames(.x))==toupper(item),] TA2<-as.numeric(TA) result <- sweep(.x, 2,TA2, FUN = \"/\") commonBS<- as.data.frame(result) ///////////////////////////////// " .C15EXPLAIN29<-"SEC filings /////////////////////////////// SEC EGDAR https://www.sec.gov/edgar/searchedgar/companysearch.html SEC index https://www.sec.gov/Archives/edgar/full-index/ ///////////////////////////////// " .C15EXPLAIN30<-" Txt examples /////////////////////////////// SEC examples : https://www.sec.gov/Archives/edgar/data/1599496/000146581817000048/0001465818-17-000048.txt edgar/data/1599496/0001465818-17-000048.txt edgar/data/1084869/0001140361-17-028809.txt edgar/1084869/0001140361-17-028809.txt edgar/data/1307969/0001683168-16-000379.txt https://www.sec.gov/Archives/edgar/data/1599496/000146581817000048/0001465818-17-000048.txt ///////////////////////////////// " .C15EXPLAIN31<-"CIK linked to Ticker /////////////////////////////// CIK : https://en.wikipedia.org/wiki/Central_Index_Key CIK-ticker : http://rankandfiled.com/#/data/tickers ///////////////////////////////// " .C15EXPLAIN32<-"tickerCIK.RData /////////////////////////////// infile<-'http://datayyy.com/data_R/tickerCIK.RData' a<-load(url(infile)) print(a) # [1] .x head(.x) TICKER CIK NAME EXCHANGE SIC BUSINESS INCORPORATED IRS 1 A 1090872 Agilent Technologies Inc NYSE 3825 CA DE 770518772 2 AA 4281 Alcoa Inc NYSE 3350 PA PA 250317820 3 AAACU 1332552 Asia Automotive Acquisition Corp 6770 DE DE 203022522 4 AABB 1287145 Asia Broadband Inc OTC 8200 GA NV 721569126 5 AABC 1024015 Access Anytime Bancorp Inc 6035 NM DE 850444597 6 AAC 1099290 Sinocoking Coal & Coke Chemical Industries Inc NASDAQ 3312 F4 FL 593404233 > dim(.x) [1] 13737 8 ///////////////////////////////// " .C15EXPLAIN33<-"SEC financial statement data sets /////////////////////////////// Financial Statement Data Sets, January 2009 - June 2024 https://www.sec.gov/about/dera_financial-statement-data-set The Financial Statement Data Sets below provide numeric information from the face financials of all financial statements. This data is extracted from exhibits to corporate financial reports filed with the Commission using eXtensible Business Reporting Language (XBRL). As compared to the more extensive Financial Statement and Notes Data Sets, which provide the numeric and narrative disclosures from all financial statements and their notes, the Financial Statement Data Sets are more compact. The information is presented without change from the \"as filed\" financial reports submitted by each registrant. The data is presented in a flattened format to help users analyze and compare corporate disclosure information over time and across registrants. The data sets also contain additional fields including a company's Standard Industrial Classification to facilitate the data's use. Data sets will be updated quarterly. Data contained in documents filed after 5:30PM Eastern on the last business day of a quarter will be included in the subsequent quarterly posting. The Financial Statements Data (PDF, 175 kb) provides documentation of scope, organization, file formats and table definitions. https://www.sec.gov/files/aqfs.pdf ///////////////////////////////// " .C15EXPLAIN34<-"2024q2 as an example /////////////////////////////// https://www.sec.gov/about/dera_financial-statement-data-set 2024q2.zip num.txt sub.txt tag.txt SUB - Submission data set; this includes one record for each XBRL submission. The set includes fields of information pertinent to the submission and the filing entity. Information is extracted from the SEC’s EDGAR system and the filings submitted to the SEC by registrants. NUM - Number data set; this includes one row for each distinct amount from each submission included in the SUB data set. The Number data set includes, for every submission, for each primary financial statement as it is rendered by the SEC Viewer/Previewer, all line item values. TAG - Tag data set; includes defining information about each tag. Information includes tag descriptions (documentation labels), taxonomy version information and other tag attributes. PRE - Presentation data set; this provides information about how the tags and numbers were presented in the primary financial statements. ///////////////////////////////// " .C15EXPLAIN35<-"several lines of four text files /////////////////////////////// pre ------------------------------------------------------------------------------------------------------------------------------- adsh report line stmt inpth rfile tag version plabel negating 0001654954-24-003968 1 37 CP 0 H AddressTypeDomain dei/2022 AddressTypeDomain 0 0001654954-24-004069 1 39 CP 0 H AddressTypeDomain dei/2022 AddressTypeDomain 0 0001654954-24-004067 1 45 CP 0 H AddressTypeDomain dei/2022 AddressTypeDomain 0 0001477932-24-001773 1 39 CP 0 H AddressTypeDomain dei/2022 AddressTypeDomain 0 0001493152-24-014091 1 3 CP 0 H AddressTypeDomain dei/2022 AddressTypeDomain 0 0001193125-24-093838 1 3 CP 0 H AddressTypeDomain dei/2022 Address Type [Domain] 0 0001554855-24-000282 1 7 CP 0 H AddressTypeDomain dei/2022 Address Type [Domain] 0 0001104659-24-050776 1 8 CP 0 H AddressTypeDomain dei/2022 Address Type [Domain] 0 0001558370-24-005900 1 7 CP 0 H AddressTypeDomain dei/2022 Address Type [Domain] 0 0001654954-24-005154 1 43 CP 0 H AddressTypeDomain dei/2022 AddressTypeDomain 0 0001654954-24-005203 1 41 CP 0 H AddressTypeDomain dei/2022 AddressTypeDomain 0 0001104659-24-054814 1 3 CP 0 H AddressTypeDomain dei/2022 Address Type [Domain] 0 num ------------------------------------------------------------------------------------------------------------------------------- adsh tag version coreg ddate qtrs uom value footnote 0001193125-24-163247 SharePrice us-gaap/2023 20210630 0 USD 9.7100 0001193125-24-163247 SharePrice us-gaap/2023 20210930 0 USD 9.7600 0001193125-24-163247 SharePrice us-gaap/2023 20211231 0 USD 9.7000 0001193125-24-163247 SharePrice us-gaap/2023 20220331 0 USD 8.1200 0001193125-24-163247 SharePrice us-gaap/2023 20220630 0 USD 7.0600 0001193125-24-163247 SharePrice us-gaap/2023 20220930 0 USD 6.4600 0001193125-24-163247 SharePrice us-gaap/2023 20221231 0 USD 6.5000 0001193125-24-163247 SharePrice us-gaap/2023 20230331 0 USD 6.6300 0001193125-24-163247 SharePrice us-gaap/2023 20230630 0 USD 6.7200 0001193125-24-163247 SharePrice us-gaap/2023 20230930 0 USD 6.7100 0001193125-24-163247 SharePrice us-gaap/2023 20231231 0 USD 7.1500 0001193125-24-163247 SharePrice us-gaap/2023 20240331 0 USD 7.6600 sub ------------------------------------------------------------------------- adsh cik name sic countryba stprba cityba zipba bas1 bas2 baph countryma stprma cityma zipma mas1 mas2 countryinc stprinc ein former changed afs wksi fye form period fy fp filed accepted prevrpt detail instance nciks aciks 0000029644-24-000073 29644 DONALDSON CO INC 3564 US MN BLOOMINGTON 55431 1400 W. 94TH ST. 6128873131 US MN BLOOMINGTON 55431 1400 W 94TH STREET US DE 410222640 DONALDSON CO INC 19920703 1-LAF 0 0731 8-K 20240630 20240624 2024-06-24 17:19:00.0 0 0 dci-20240624_htm.xml 1 0000049938-24-000037 49938 IMPERIAL OIL LTD 2911 CA AB CALGARY T2C 5N1 505 QUARRY PARK BOULEVARD S.E. 1-800-567-3776 CA AB CALGARY T2C 5N1 505 QUARRY PARK BOULEVARD S.E. 980017682 1-LAF 0 1231 8-K 20240630 20240624 2024-06-24 07:57:00.0 0 0 imo-20240624_htm.xml 1 0000062709-24-000056 62709 MARSH & MCLENNAN COMPANIES, INC. 6411 US NY NEW YORK 10036 1166 AVENUE OF THE AMERICAS 2123455000 US NY NEW YORK 10036 1166 AVENUE OF THE AMERICAS US DE 362668272 MARSH & MCLENNAN COMPANIES INC 19920703 1-LAF 0 1231 8-K 20240630 20240624 2024-06-24 16:03:00.0 0 0 mmc-20240624_htm.xml 1 0000075594-24-000013 75594 PACIFICORP /OR/ 4911 US OR PORTLAND 97232 825 NE MULTNOMAH SUITE 1900 888-221-7070 US OR PORTLAND 97232 825 NE MULTNOMAH SUITE 1900 US OR 930246090 PC/UP&L MERGING CORP 19890628 0 1231 8-K 20240630 20240624 2024-06-24 16:42:00.0 0 0 pacificorp-20240619_htm.xml 1 taq.txt ------------------------------------------ ag version custom abstract datatype iord crdr tlabel doc AddressTypeDomain dei/2022 0 1 member Address Type [Domain] An entity may have several addresses for different purposes and this domain represents all such types. AdrMember dei/2022 0 1 member ADR [Member] American Depositary Receipt (or American Depositary Share, ADS). AmendmentDescription dei/2022 0 0 string D Amendment Description Description of changes contained within amended document. AmendmentFlag dei/2022 0 0 boolean D Amendment Flag Boolean flag that is true when the XBRL content amends previously-filed or accepted submission. AnnualInformationForm dei/2022 0 0 boolean D Annual Information Form Boolean flag with value true on a form if it is an annual report containing an annual information form. AuditedAnnualFinancialStatements dei/2022 0 0 boolean D Audited Annual Financial Statements Boolean flag with value true on a form if it is an annual report containing audited financial statements. AuditorFirmId dei/2022 0 0 nonemptySequenceNumb D Auditor Firm ID PCAOB issued Audit Firm Identifier AuditorLocation dei/2022 0 0 internationalName D Auditor Location AuditorName dei/2022 0 0 internationalName D Auditor Name ///////////////////////////////// " .C15EXPLAIN36<-"Explanation /////////////////////////////// 1. SUB is identifies all the EDGAR submissions in the data set, with each row having the unique (primary) key adsh, a 20 character EDGAR Accession Number with dashes in positions 11 and 14. 2. TAG is a data set of all tags used in the submissions, both standard and custom. A unique key of each row is a combination of these fields: 1) tag – tag used by the filer 2) version – if a standard tag, the taxonomy of origin, otherwise equal to adsh. 3. NUM is a data set of all numeric XBRL facts presented on the primary financial statements. A unique key of each row is a combination of the following fields: 1) adsh- EDGAR accession number 2) tag – tag used by the filer 3) version – if a standard tag, the taxonomy of origin, otherwise equal to adsh. 4) ddate - period end date 5) qtrs - duration in number of quarters 6) uom - unit of measure 7) coreg - coregistrant of the parent company registrant (if applicable) 4. PRE is a data set that provides the text assigned by the filer to each line item in the primary financial statements, the order in which the line item appeared, and the tag assigned to it. A unique key of each row is a combination of the following fields: 1) adsh – EDGAR accession number 2) report – sequential number of report within the statements 3) line – sequential number of line within a report. ///////////////////////////////// " .C15EXPLAIN37<-"bs2024q2.RData /////////////////////////////// a<-load(\"bs2024q2.RData\") print(a) dim(.x) [1] 13737 8 head(.x) TICKER CIK NAME EXCHANGE SIC BUSINESS INCORPORATED IRS 1 A 1090872 Agilent Technologies Inc NYSE 3825 CA DE 770518772 2 AA 4281 Alcoa Inc NYSE 3350 PA PA 250317820 3 AAACU 1332552 Asia Automotive Acquisition Corp 6770 DE DE 203022522 4 AABB 1287145 Asia Broadband Inc OTC 8200 GA NV 721569126 5 AABC 1024015 Access Anytime Bancorp Inc 6035 NM DE 850444597 6 AAC 1099290 Sinocoking Coal & Coke Chemical Industries Inc NASDAQ 3312 F4 FL 593404233 > ///////////////////////////////// " .C15EXPLAIN38<-"is2024q2.RData /////////////////////////////// a<-load(\"is2024q2.RData\") print(a) dim(.x) [1] 161567 6 head(.x) TICKER CIK NAME PERIOD 1 ABT 1800 ABBOTT LABORATORIES 20240331 2 ABT 1800 ABBOTT LABORATORIES 20240331 3 ABT 1800 ABBOTT LABORATORIES 20240331 4 ABT 1800 ABBOTT LABORATORIES 20240331 5 ABT 1800 ABBOTT LABORATORIES 20240331 6 ABT 1800 ABBOTT LABORATORIES 20240331 PLABEL VALUE 1 Taxes on earnings 244000000.0000 2 Average Number of Common Shares Outstanding Plus Dilutive Common Stock Options (in shares) 1751715000.0000 3 Net Earnings 1225000000.0000 4 Research and development 654000000.0000 5 Diluted Earnings Per Common Share (in dollars per share) 0.7000 6 Taxes on earnings 211000000.0000 ///////////////////////////////// " .C15EXPLAIN39<-"cf2024q2.RData /////////////////////////////// a<-load(\"cf2024q2.RData\") print(a) dim(.x) head(.x) ///////////////////////////////// " .C15EXPLAIN40<-"Generate BS, IS, CF for 2024Q2 /////////////////////////////// setwd(\"c://yan/teaching/fmr/_backup/data/sec_fin_statement_data_sets/2024q2/\") sub <-read.delim2(\"sub.txt\",header = TRUE) pre <-read.delim2(\"pre.txt\", header = TRUE) num <-read.delim2(\"num.txt\", header = TRUE) # m1<-merge(sub,pre) m2 <-merge(num,m1) # d<-load(\"../tickerCik.RData\") # print(d) head(.x) a<-.x[,1:2] period<-\"2024q2\" # fun3<-function(data,name,yearq){ # name BS yearq 2024q2 if(toupper(name)==\"BS\"){ d0<-subset(data,stmt==\"BS\",select =c(cik,tag, plabel,value,report,line,name,period,ddate)) }else if(toupper(name)==\"IS\"){ d0<-subset(data,stmt==\"IS\",select =c(cik,tag, plabel,value,report,line,name,period,ddate)) }else{ d0<-subset(data,stmt==\"CF\",select =c(cik,tag, plabel,value,report,line,name,period,ddate)) } d <- d0[order(d0$name, d0$report, d0$line),] rownames(d)<-NULL colnames(d)<-toupper(colnames(d)) b<-merge(d,a) .x<-data.frame(b$TICKER,b$CIK,b$NAME,b$PERIOD,b$PLABEL,b$VALUE) names<-gsub(\"^b.\",\"\",colnames(.x)) colnames(.x)<-names outfile<-paste0(\"c://temp/\",name,yearq,\".RData\") save(.x,file=outfile) } # fun3(m2,\"bs\",period) fun3(m2,\"is\",period) fun3(m2,\"cf\",period) ///////////////////////////////// " .C15EXPLAIN41<-"Code to generate ibmBS.RData /////////////////////////////// infile<-\"e://ibmBS_22jul2024.txt\" x<-readLines(infile) length(x) x2<-x[nchar(x)!=0] x3<-x2[-1] n<-grep(\"[a-zA-Z]\",x3)# find out all items/starting subscript diff(n) # all the numbers should be 6 # names<-x3[n] final<-names for(i in 1:5) { # 5 final<-data.frame(final,x3[n+i]) } colnames(final)<-c(\"ITEM\",\"2023\",\"2022\",\"2021\",\"2020\",\"2019\") rownames(final)<-final$ITEM final2<-final[,c(-1,-6)] n<-nrow(final2) m<-ncol(final2) .x<-matrix(rep(NA,n*m),n,m) for(i in 1:n){ for(j in 1:m){ a<-gsub(\",\",\"\",final2[i,j]) .x[i,j]<-as.numeric(a) } } .x<-data.frame(.x) rownames(.x)<-rownames(final2) colnames(.x)<-colnames(final2) save(.x,file=\"ibmBS22jul2024.RData\") ///////////////////////////////// " .C15EXPLAIN42<-"Generate ibmIS.RData /////////////////////////////// infile<-'d://ibmIncomeStatement22jul2024.txt' x<-readLines(infile) length(x) x2<-x[nchar(x)!=0] x3<-x2[-1] n<-grep(\"[a-zA-Z]\",x3) # find out all items/starting subscript diff(n) # all the numbers should be 6 # names<-x3[n] final<-names for(i in 1:6) { # 5 final<-data.frame(final,x3[n+i]) } colnames(final)<-c(\"ITEM\",\"2023\",\"2022\",\"2021\",\"2020\",\"2019\",\"haha\") .x<-final[,-7] save(.x,file=\"ibmIS22jul2024.RData\") ///////////////////////////////// " .C15EXPLAIN43<-" /////////////////////////////// infile<-'d://ibmCashFlowStatement22jul2024.txt' x<-readLines(infile) length(x) x2<-x[nchar(x)!=0] x3<-x2[-1] n<-grep(\"[a-zA-Z]\",x3) # find out all items/starting subscript diff(n) # all the numbers should be 6 # names<-x3[n] final<-names for(i in 1:6) { # 5 final<-data.frame(final,x3[n+i]) } colnames(final)<-c(\"ITEM\",\"2023\",\"2022\",\"2021\",\"2020\",\"2019\",\"haha\") .x<-final[,-7] save(.x,file=\"ibmCF22jul2024.RData\") ///////////////////////////////// " .C15EXPLAIN44<-"Getting Time Series data /////////////////////////////// library(quantmod) getSymbols(\"AAPL\", src = \"yahoo\") ///////////////////////////////// " .C15EXPLAIN45<-" /////////////////////////////// > help(package=quantmod) > x<-viewFin(getFin(\"DELL\",auto.assign=FALSE),\"BS\",\"A\") Error: ‘getFinancials.google’ is defunct. Google Finance stopped providing data in March, 2018. You could try some of the data sources via Quandl instead. See help(\"Defunct\") and help(\"quantmod-defunct\") ///////////////////////////////// " .C15EXPLAIN46<-" /////////////////////////////// #library(XML) #x<-readHTMLTable(\"https://www.marketwatch.com/investing/stock/ibm/financials?mod=mw_quote_tab\") ///////////////////////////////// "