Why user-written Programs

The following list of Stata programs can be utilized in finance and accounting research and other related fields. In finance, we often work with large datasets, and some of the built-in data tools in Stata can be quite slow when processing such data sets. For example, the xtile command used for creating quantile groups, or the rolling command for rolling window calculations, can be particularly slow. These limitations have been a source of frustration for me and have motivated me to develop the following commands.

 

1.  asm : A Stata program to create momentum portfolios

[available for nominal price]
I have written an easy to use Stata® program, asm.ado for creation and testing of momentum portfolio returns. The program offers a large number of options which have been used in the momentum literature. This program employs well-known momentum portfolio strategies as suggested in Jagadesh and Titman (1993) and many other options suggested in subsequent papers. This program is equally useful for academics and practitioners. The program offers the following features:… Read more …

 


2.  asdoc: A Stata program to easily send Stata output to MS Word

[available for free]
asdoc sends Stata output to Word / RTF format. asdoc creates high-quality, publication-ready tables from various Stata commands such as summarize, correlate, pwcorr, tab1, tab2, tabulate1, tabulate2, tabstat, ttest, regress, table, amean, proportions, means, and many more. Using asdoc is pretty easy. We need to just add asdoc as a prefix to Stata commands. asdoc has several built-in routines for dedicated calculations and making nicely formatted tables.
.. Read more …

 

3.  asrol : A Stata program to generate rolling-window statistics and by-group statistics

[available for free]
asrol calculates descriptive statistics in a user’s defined rolling-window or over a grouping variable. The descriptive statistics include standard deviation, mean, median, geometric mean, products, count, minimum, maximum, number of missing values, first observation, last observation, and total.   asrol can efficiently handle all types of data structures such as data declared as time series or panel data, undeclared data, or data with duplicate values, missing values or data having time series gaps.. Read more …


 

4.  ascol : To convert returns and prices from daily to weekly, monthly… frequency.

[available for free]
It is pretty easy with ascol to convert stock returns or prices data from daily to weekly, monthly, quarterly, or yearly frequency. Since returns and prices need different treatments for conversion (returns need to be summed for their conversion from daily to say weekly frequency, while in case of prices, the conversion will just results in producing end of the week prices.), the program gives us both the option of converting returns and prices data. data, undeclared data, or data with duplicate values, missing values or data having time series gaps.. Read more …

 


 

5.  asreg : A Stata program for rolling-window and by-group regressions

[available for free]
asreg fits a model of the dependent variable on independent variables using linear regression in a user’s defined rolling window or by a grouping variable. The estimation of rolling beta or cross-sectional regression is very common in finance. asreg is very efficient in both estimation of rolling-window regressions or cross-sectional regressions. asreg is an order of magnitude faster than estimating rolling window regressions through conventional methods such as Stata loops or using the Stata’s official rolling command. asreg has the same speed efficiency as asrol. All the rolling window calculations, estimation of regression parameters, and writing the results to Stata variables are done in the Mata language. Read more …


 

6.  astile : A Stata program for creating quantile categories

[available for free]
astile creates a new variable that categorizes exp by its quantiles. For example, we might be interested in making 10 firm size-based portfolios. This will involve placing the smallest 10% firms in portfolio 1, next 10% in portfolio 2, and so on. astile creates a new variable as specified in the newvar option from the existing variable which is specified in the = exp. Values of the newvar ranges from 1, 2, 3, … up to n, where n is the maximum number of quantile groups specified in the nq option. For example, if we want to make 10 portfolios, values of the newvar will range from 1 to 10.
. Read more …


 

7.  asgen : A Stata program for generating weighted average mean

[available for free]
asgen creates a new variable from an existing variable or an expression. The new variable contains weighted average mean. The existing variable is supplied to asgen by the =exp. The weights are based on the values of an existing numeric variable, that is specified in the weight(varname) option. asgen accepts both the [if] [in] qualifiers for performing the required calculations on a subset of data. Further, the use of =exp can come handy in many situations where we want to make changes on the fly before we find the weighted average mean.
Read more …


 

8.  astx : Creates a table of descriptive statistics by a grouping variable.

[available for free]
astx finds descriptive statistics for a specific variable over a grouping variable. Further, it estimates t-statistics and sends the output file to MS Excel File. Read more …


 

9.  searchfor : Searches for texts in selected or all string variables.

[available for free]
searchfor finds text in string variables and either lists the selected variables on screen or edits the variables in Data Editor. The search text is capitalization free. Read more …