*! 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 genl version 5.0 local varlist "req new max(1)" local exp "req nopre" local if "opt" local in "opt" local options "by(str) Label(str) noDef" parse "`*'" * scratch variable x tempvar x rename `varlist' `x' * by clause if "`by'" != "" { unabbrev `by', min(1) local by "$S_1" local sorder : sortedby * only change sort-oder if required if "`sorder'" == "" | index("#`sorder'","#`by'") == 0 { sort `by' } local By "by `by': " } * evaluate expression quietly `By' replace `x' = `exp' `if' `in' * define char Defntion if "`def'" == "" { char define `x'[Defntion] "`By'`exp' `if' `in'" } * define variable label if "`label'" == "" { local label "`exp' `if' `in'" if length("`label'") > 31 { local label = substr("`exp'",1,28) + "..." } } else if "`label'" == "_" { local label } label var `x' "`label'" * rename scratch variable to name rename `x' `varlist' end exit