*! version 1.0.0 02/02/93 STB-13: dm13.1 program define mixcase version 3.0 local varlist "req ex max(1)" local if "opt" local in "opt" parse "`*'" local v "`varlist'" tempvar col rcol quietly { replace `v'=upper(substr(`v',1,1))+lower(substr(`v',2,.)) /* */ `if' `in' gen byte `col'=1 gen byte `rcol'=. while 1 { replace `rcol'=index(substr(`v',`col',.)," ") /* */ `if' `in' capture assert `rcol'==0 `if' `in' if _rc==0 { exit } replace `rcol'=`rcol'+`col'-1 if `rcol'!=0 & `rcol'!=. replace `v'=substr(`v',1,`rcol') + /* */ upper(substr(`v',`rcol'+1,1)) + /* */ substr(`v',`rcol'+2,.) /* */ if `rcol'!=0 & `rcol'!=. replace `col'=`rcol'+1 if `rcol'!=0 & `rcol'!=. } /*NOTREACHED*/ end