This worked for me (I made up a svy weight).
Code:
putexcel set putexcel2.xlsx, sheet(example1) replace putexcel A1 = "Variable" putexcel B1 = "Bachelor_hes?" putexcel C1 = "Means" local row = 2 foreach var in wasgach wasgeink wasfihan wasmfqe wasfach11 wasfort wasfawe wasmtza wasbeta wasfrei { forv i = 0/3 { svy, subpop(Bachelor_hes`i'): mean `var' local m = el(r(table),1,1) putexcel A`row' = "`var'" putexcel B`row' = "Bachelor_hes`i'" putexcel C`row' = `m' local ++row } }
Comment