Categories
 Data (8)
 Learning Resources (8)
 Python (8)
 SAS (14)
 Stata (22)
 Uncategorized (1)

Recent Posts
Recent Comments
 Bram Reysenberg on Stata command to create FamaFrench industry classifications based on SIC codes
 Wenjing on Calculate market value of equity: use CRSP or Compustat?
 Vaso on Display mean and median test results in Stata
 Kai Chen on Display mean and median test results in Stata
 Vaso on Display mean and median test results in Stata
Archives
Meta
Category Archives: SAS
Export a SAS dataset to Stata with all variable names converted to lowercase
I use both SAS and Stata and often need to transfer data between the two. SAS is casesensitive and Stata is not. I always prefer working with lowercase variable names in Stata. The following code is used to export a … Continue reading
Posted in SAS
Leave a comment
Clean up TRACE Enhanced dataset
WRDS provides an excellent manual (link) and SAS code (link) for cleaning up the raw TRACE Enhanced bond transaction data, primarily based on the work done by Dick‐Nielsen, Jens, How to Clean Enhanced TRACE Data (December 3, 2014). Available at … Continue reading
Posted in SAS
Leave a comment
SAS macro to count the number of analysts following a firm
This macro is used to count the number of analysts who followed a specific firm. Although this is a commonly used measure in literature, prior studies often give a vague description on what they do. The question is—what does “analysts … Continue reading
Calculate idiosyncratic stock return volatility
I have noted two slightly different definitions of idiosyncratic stock return volatility in: Campbell, J. Y. and Taksler, G. B. (2003), Equity Volatility and Corporate Bond Yields. The Journal of Finance, 58: 2321–2350. doi:10.1046/j.15406261.2003.00607.x Rajgopal, S. and Venkatachalam, M. (2011), … Continue reading
Posted in SAS
8 Comments
Download FR Y9C data from WRDS
WRDS currently populates FR Y9C data quarter by quarter in individual datasets, like BHCF200803, BHCF200806, BHCF200809 and so on. WRDS has not stacked those individual datasets to formulate a single timeseries dataset like COMPUSTAT. There are two ways to overcome … Continue reading
Posted in Data, SAS
2 Comments
The impact of WRDS transition to the new WRDS Cloud server
WRDS has quietly started the transition from the old server to the new Cloud server. This move makes a lot of support documentation on the WRDS website outdated and misleading. That is why I think WRDS should direct its resources on continuously … Continue reading
Posted in Learning Resources, SAS
2 Comments
Rollingwindow computation in SAS and Stata
SASers often find proc expand plus transformout very useful for rollingwindow (or movingwindow) computation. Stataers may wonder if there is a counter party in Stata. The answer is “yes”. The command in Stata is rolling. See the manual below: http://www.stata.com/manuals13/tsrolling.pdf The … Continue reading
Posted in Learning Resources, SAS, Stata
Leave a comment
SAS macro for event study and beta
There are two macros on the List of WRDS Research Macros: EVTSTUDY and BETA, which may be often used. I like the first one, written by Denys Glushkov. Denys’ codes are always elegant. I don’t like the second one because … Continue reading
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
3 Comments
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)