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
Fuzzy RDD with possible BootstrapDear all, I have a question and I would like to ask for advice. I am trying to evaluate the impact …
SchemesI have just upgraded from 15 to 16. Is there any way to import my schemes from 15 without having to …
OLS regression where one independent variable is a rare eventHello all, I am performance ols regression, something like: regress y i.x1##i.x2 x3 x4 x5, cluster…
Keep last 4 digits of a numeric variableHi everyone, I would like to ask you how can I keep the last 4 digits of the variable date. It is a …
Managing workflow with the global macroHello Stata users, I am trying to use the global macro to switch between subfolders. For instance, …
Subscribe to:
Post Comments (Atom)
0 Response to Looping egen mean weight
Post a Comment