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?
Related Posts with Replace missing data with mean or average for summative scale purposes
poisson regression (ppmlhdfe) with multiplicative errorIs there a way to force ppmlhdfe to use multiplicative error term instead of additive? I wan to run…
Unequal number of observations in percentile groupsHi Stata users, I am trying to come up with percentile groups using the code below Code: _pctile …
Creating a combined graphHi, I'm struggling to get this right. I have 2 variables that I want to show on a single graph. Fir…
estimating 5 year survivalHi, I have a dataset with survival months and event (dead/alive). I have been able to stset it and c…
Constructing Gini Index for Household dataDear All I'm computing the Gini coefficient in Stata 16 with the" ineqdeco" command. I'm using panel…
Subscribe to:
Post Comments (Atom)
0 Response to Replace missing data with mean or average for summative scale purposes
Post a Comment