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.
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.
Comment