// Robert A. Yaffee   Program to standardize a variable

cap program drop stdz
program stdz, rclass
syntax varlist [if] [in]
qui summ `1', detail
qui gen m`1' = r(mean)
qui gen sd`1' = r(sd)
qui gen z1`1' = (`1' - m`1')/sd`1'
drop m`1'
drop sd`1'
end