Small fixes
Small bugs here and there are probably the most time-consuming details when working on Stata. Here I simply park some useful code snippets that I came across during my work:
Similar to Python Pandas’s .fillna(), here is to extract the mode value of a given column, then generate a uni-value new column:
egen column_filled_NA_with_mode = mode(column_with_missing values)
Temporarily saving a working dataset and re-using it after
use ./master_file, clear tempfile master save `master', replace [do some destruction here] tempfile destructed save `destructed', replace use `master' [stop doing destruction]