Gtools Macro Better Jun 2026

ssc install gtools, replace

* Determine new variable name if "`generate'" == "" & "`replace'" == "" local newvar = "`oldvar'_transformed" gtools macro

else if "`generate'" != "" label variable `newvar' "Transformed from `oldvar'" ssc install gtools, replace * Determine new variable

If you use Stata 16 or later, the built-in macrolists are decent. But gtools macros remain the gold standard for heavy automation. ssc install gtools

di "Common variables: `common_all'"