*! yrxlab -- Construct xlabel() option for dates *! version 1.0 Sean Becketti July 1995 (STB-26: dm34) program define yrxlab quietly { version 4.0 local varlist "req ex" local if "opt nopre" local in "opt pre" local options "Step(real 1) Year(str)" parse "`*'" if "`if'"!="" { local andif "& (`if')" } if "`year'"=="" { local year "year" } local min = . local max = . parse "`varlist'", parse(" ") while "`1'"!="" { sum `year' if (`1'!=.) `andif' `in' local min = min(`min',_result(5)) local max = max(`max',_result(6)) mac shift } global S_1 global S_2 = `min' global S_3 = `max' if (`min'==.) | (`max'==.) { exit } steplist, from(`min') to(`max') space(",") step(`step') global S_1 "xlab(${S_1})" } end program define steplist quietly { version 4.0 local options "From(real 99) To(real 99) Space(str) STep(real 1)" parse "`*'" global S_1 if (`from'==`to') { error 98 } if (sign(`to'-`from')!=sign(`step')) { error 98 } if "`space'"=="" { local space " " } local i = `from' local list "`i'" while `i'<`to' { local i = `i' + `step' local list "`list'`space'`i'" } global S_1 "`list'" } end