Categories
 Data (8)
 Learning Resources (8)
 Python (7)
 SAS (11)
 Stata (18)
 Uncategorized (1)

Recent Posts
Recent Comments
 Kai Chen on Use Python to calculate the tone of financial articles
 Kai Chen on About Me
 Kai Chen on How to remove duplicate GVKEYDATADATE when using Compustat Annual (FUNDA) and Quarterly (FUNDQ)?
 Kai Chen on How to remove duplicate GVKEYDATADATE when using Compustat Annual (FUNDA) and Quarterly (FUNDQ)?
 Kai Chen on How to remove duplicate GVKEYDATADATE when using Compustat Annual (FUNDA) and Quarterly (FUNDQ)?
Archives
Meta
Monthly Archives: August 2015
How to remove duplicate GVKEYDATADATE when using Compustat Annual (FUNDA) and Quarterly (FUNDQ)?
The annual data (FUNDA) is easy to deal with, we just need to apply the following conditions: indfmt==”INDL” & datafmt==”STD” & popsrc==”D” & consol==”C” If we have converted FUNDA to Stata format, the uniqueness of GVKEYDATADATE can be verified using … Continue reading
Posted in Data, Stata
10 Comments
If beginning year and ending year are known, how to fill in years in between?
Question: Suppose two companies A and B are connected in some years. Say, right now the data structure is the following: Company 1 Company 2 Starting Year Ending Year A B 2000 2006 A C 1998 2003 C D 1995 … Continue reading
Posted in SAS
Leave a comment
SAS macro to get analysts EPS consensus for a given fiscal period end (DATADATE) by a selected date (DATE)
Update: contains error! will update later. I write this macro to compute analysts’ quarterly EPS consensus on a selected date (DATE) for a given fiscal quarter end (DATADATE). This macro can be easily modified for other types of estimates (e.g., annual EPS). This macro … Continue reading
Posted in SAS
Comments Off on SAS macro to get analysts EPS consensus for a given fiscal period end (DATADATE) by a selected date (DATE)
Link Audit Analytics, Compustat, CRSP and I/B/E/S
The following program is used to link each financial restatement in Audit Analytics to Compustat, CRSP, and I/B/E/S. The resultant dataset aa contains unique identifiers of Audit Analytics (res_notify_key), Compustat (gvkey), CRSP (permno), and I/B/E/S (ibtic). Please note this program … Continue reading
Posted in SAS
13 Comments
Regression with a large dummyvariable set (e.g., firm and year fixed effects) in Stata
I run a regression in Stata with a Compustat dataset that contains fyear and gvkey. I want to add firm and year fixed effects, so I type the following command: regress DV IV i.fyear i.gvkey But Stata returns the error … Continue reading
Posted in Stata
Leave a comment