Merging datasets in Stata on long strings and less precise matching criterion
The Problem Consider the following two datasets where company names are not exactly the same in both the datasets, still we want to merge them using the name variable as the merging criterion. How that can be done in Stata. name in dataset 1 name dataset 2 symbol data set2 The Pakistan General Insurance Co. [...]
asdoc: Export Stata dta file to MS Word
Creating tables in Stata using asdoc is super-easy. In this short post, I'll show how to use asdoc to export Stata data to MS word files. If you have not already installed asdoc, it can be installed by ssc install asdoc For exporting values from the data files, we can use the sub-command list [...]
ASROL Version update: calculation of geometric mean and products in a rolling window and over groups in Stata
Description asrol calculates descriptive statistics in a user's defined rolling-window or over a grouping variable. 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. asrol can be used for [...]
asreg: Get standard errors of the first stage regression of the Fama and MacBeth (1973) Procedure in Stata
In the following example, we shall use asreg that can be installed from SSC by typing the following line in Stata command window ssc install asreg The problem Let's say that we wish to report different regression statistics from Fama and MacBeth (1973) regression such the standard errors of variables. Using the fmb [...]
ascol : A Stata package to convert daily stock prices and returns data to weekly, monthly, quarter, or year frequencies
Description ascol converts daily data of asset prices or returns to weekly, monthly, quarterly, or yearly frequencies. When converting asset prices to a lower frequency, ascol selects the last price in the given period. For converting asset returns, ascol offers two possibilities - either to sum the daily returns or find products of the daily returns. [...]
Quick Table for Converting Different Dates to Stata Format
Daily Dates Copying data from the internet, CSV files, or other sources into Stata will record the date as a string variable, shown with red color. Before we can use the Stata time-series or panel-data capabilities, we need to convert the string date to a Stata date. In the following table, the first column shows [...]