I want to generate new variable or scalar to
record
the mean of var1-var6 by group: countryI want to write:
foreach v of varlist var1-var6{
bys country:egen m`i'=mean(`v')
or some command like
foreach v of varlist var1-var6{
bys country: sumreturn list
gen ...
but I could write neither correctly to solve my problem.
Could anyone give me a hand?
Thanks so much!
0 Response to problem with forvalue,foreach
Post a Comment