*! 2.0.1 (Jan 03, 1997) Jeroen Weesie/ICS STB-35 dm43 *! 1.0.0 (May 26, 1990) Albert Verbeek & Jeroen Weesie/ICS program define redo version 5.0 local varlist "req exist" parse "`*'" parse "`varlist'", p(" ") while "`1'" != "" { local def : char `1'[Defntion] if "`def'" != "" { if substr("`def'",1,3) != "by " { capt replace `1' = `def' if _rc { di in re "Failure to apply --Defntion-- of `1'" exit 198 } } else { bycmd `1' `def' } } else { di in bl "Warning: `1' has no --Defntion--" } mac shift } end program define bycmd version 5.0 local v "`1'" mac shift parse "`*'", p(":") local by "`1'" mac shift 2 local cmd "`*'" local by = substr("`by'", 4, .) * only change sort-order if required local sorder : sortedby if "`sorder'" == "" | index("#`sorder'","#`by'") == 0 { capture sort `by' if _rc { di in re "failure to sort on `by'" exit 198 } } capture by `by' : replace `v' = `cmd' if _rc { di in re "Failure to apply --Defntion-- of `1'" exit 198 } end exit