Code


Stata Commands


CHIMCHAR: Stata module to thoroughly clean string variables

chimchar stands for CHanging IMpractical CHARacters. It removes characters from string variables that can impede functions like destring and reclink. You can choose to remove only special characters, remove both special characters and numeric characters, or remove all non-numeric characters altogether. If letters are not removed, special characters that are based on Latin letters are replaced with their closest ASCII (plain Latin) letter counterpart(s); for example, "Æ", "š" and "ĸ" would become "ae", "s", and "k", respectively.


DATEFRAC: Stata module to convert calendar dates to fractional years

datefrac takes any variable that represents an exact date and generates a numeric variable representing the fraction of that year that has passed at the beginning of that date by taking the number of days since 1 January of a given year, dividing that number by 365, and adding the resulting fraction to the given year. For example, datefrac assigns the value 2020.000 (2020 + 0/365) to the date 1 January 2020 and the value 1999.17260 (1999 + 63/365) to the date 4 March 1999. It also accounts for leap years if the year is a multiple of 4, assigning the value 2000.17486 (2000 + 64/366) to the date 4 March 2000.


SUPERCOMPRESS: Stata module to run compress on all datasets in a folder and its subfolders

supercompress is a command designed for organizations that 1) work with very large datasets and 2) experience data constraints. It attempts to reduce the amount of memory used by your data by running Stata's native compress command on every Stata dataset it can find within a given folder and all of its subfolders.