Gtools Macro Link

* Temporary variable for calculations tempvar tempvar * Apply if/in conditions marksample touse, novarlist mark `touse' `if' `in' * Create initial copy quietly gen `tempvar' = `oldvar' if `touse'

* Verify variable exists confirm variable `oldvar' gtools macro

* Parse variable list - use first variable only tokenize `varlist' local oldvar = "`1'" * Temporary variable for calculations tempvar tempvar *

* Check if variable exists if "`replace'" == "" capture confirm new variable `newvar' if _rc != 0 di as error "Variable `newvar' already exists. Use replace option." exit 198 gtools macro