Gtools Macro Link
* Verify variable exists confirm variable `oldvar'
*! gtools_macro.ado *! Full-featured data transformation and recoding tool *! Version 1.0 gtools macro
* 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 * Verify variable exists confirm variable `oldvar' *
* Determine new variable name if "`generate'" == "" & "`replace'" == "" local newvar = "`oldvar'_transformed" else if "`generate'" != "" local newvar = "`generate'" else if "`replace'" != "" local newvar = "`oldvar'" Version 1
* Parse variable list - use first variable only tokenize `varlist' local oldvar = "`1'"
program define gtools_macro version 15 syntax [varlist] [if] [in] [, /// RECode(numlist) /// GENerate(string) /// LABel(string) /// CUTpoints(numlist) /// BINs(integer 5) /// STDize /// LOG /// SQRT /// SQUare /// RANK /// Center /// PErcentile(integer 10) /// TOPcode(real 99) /// BOTtomcode(real 1) /// MISSing(real .) /// REPLace /// DROPold /// VERBose /// SAVe(string) /// APPend(string) /// STATistics /// HELP /// ]