Hi all,
I am supposed to get a single mean_weight variable.
Original egen code: egen weight_mean = rowmean(weight1 weight2 weight3)
Code I used:
foreach var of varlist weight1 weight2 weight3 {
su `var', d
egen `var'_mean = rowmean(`var')
}
I am not sure where I went wrong, but I ended up with three mean_weight variables (mean_weight1, mean_weight2, mean_weight3) after using the code above. I am supposed to get mean_weight alone.
Related Posts with Looping egen mean weight
Calculating first four central moments of a discrete prior distribution (efficient way)Hello, I have a set of variables in which combined produces a prior belief distribution over possib…
Compare distribution of residuals by groupsI would like to compare the distribution of the residuals of regression, by two groups. Here is an e…
Sorting 2000 variables as descending valuesHi there. I have a dataset with 2001 variables, where I want to sort each of variables 2 to 2000 in…
Power analysis for spearman rhoHi, I want to conduct a power analysis for spearman, and reading some instructions I have been asked…
Get percents using tabstatHi all I am trying to get percents from a tabstat table. I know that using tabulate command is much…
Subscribe to:
Post Comments (Atom)
0 Response to Looping egen mean weight
Post a Comment