-
Categories
- Data (8)
- Learning Resources (11)
- Python (8)
- SAS (13)
- Stata (27)
Archives
- June 2024 (1)
- January 2024 (1)
- September 2023 (1)
- August 2023 (1)
- May 2023 (1)
- February 2022 (2)
- January 2022 (1)
- August 2021 (1)
- September 2019 (1)
- August 2019 (2)
- July 2019 (2)
- May 2019 (1)
- April 2019 (1)
- March 2019 (1)
- August 2018 (3)
- July 2018 (4)
- December 2017 (1)
- November 2017 (1)
- October 2017 (1)
- September 2017 (1)
- April 2017 (2)
- September 2016 (1)
- April 2016 (1)
- December 2015 (1)
- November 2015 (1)
- September 2015 (4)
- August 2015 (5)
- June 2015 (3)
- March 2015 (7)
- February 2015 (2)
Tag Archives: Stata
How to prevent the “log file already open” error when working with log files in Stata
Sometimes we use the log using filename, replace command at the beginning of a Do file to open a log file and record everything displayed in the Results window. However, if an error interrupts the previous execution of the Do … Continue reading
Stata command to draw a graph showing the average of a variable by group
Suppose we have the following dataset that provides the life expectancy (lexp) of each country in each region: We can draw a bar graph to show the average (or other statistics) life expectancy of each region using two different methods: … Continue reading
Stata command to rename groups of variables
Swap variable names: rename (v1 v2) (v2 v1) Lowercase (or uppercase, or propercase) groups of variable names: rename V1 V2, lower or rename *, lower Add suffix _old to variables v1, v2, … for one or more digits: rename v# … Continue reading
Stata command to perform propensity score matching (PSM)
Most propensity score matching (PSM) examples typically use cross-sectional data rather than panel data. However, in accounting research, panel data (observations with two subscripts i and t, e.g., firm-years) are often used in a difference-in-differences (DID) research design. This involves … Continue reading
How to remove duplicate GVKEY-DATADATE when using Compustat Annual (FUNDA) and Quarterly (FUNDQ) data?
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 GVKEY–DATADATE can be verified using … Continue reading