Hi, I fully understand the issues with mean imputation, but I still need to use this as a quick solution to build proxy scales (not for publishable work). I have 65 variables and ~10k observations. Observations are named rf1, rf2, rf3...rf65. I've tried this:

foreach var of varlist rf* {
2. quietly sum 'var'
3. replace 'var' = r(mean) if missing('var')
4. }

but I get the "invalid name r(198);" error message. How else could I approach this?