Good afternoon,
Is there a command that allows you to center around the median of a continuous variable?
Best,
Tess
Is there a command that allows you to center around the median of a continuous variable?
Best,
Tess
program centermed *! 1.0.0 NJC 21 Oct 2021 version 8.2 syntax varlist [if] [in] quietly { marksample touse, novarlist count if `touse' if r(N) == 0 error 2000 ds `varlist', has(type numeric) if "`r(varlist)'" == "" error 102 foreach v in `r(varlist)' { centile `v' if `touse' gen `v'_med = `v' - r(c_1) if `touse' local lbl : var label `v' if `'"`lbl'"' == "" local lbl "`v'" if length(`"`lbl'"') > 71 label var `v'_med "`v' - median" else label var `v'_med `"`lbl' - median"' } } end
sysuse auto, clear centermed *
Comment