All,
I am using Stata 14.1. I have the following code. The code works for the first loop. However, for the second loop - I receive an error message stating svywgt not found r(111). I am not sure why the svywgt is not found after the first loop?
Thanks,
I am using Stata 14.1. I have the following code. The code works for the first loop. However, for the second loop - I receive an error message stating svywgt not found r(111). I am not sure why the svywgt is not found after the first loop?
Code:
preserve forval num = 1/12 { collapse (p10) p10_* (p20) p20_* (p30) p30_* (p40) p40_* (p50) p50_* /// (mean) avg_* (p60) p60_* (p70) p70_* (p80) p80_* (p90) p90_* /// [aweight = svywgt] if age == 1 & region == `num' export excel using test2.xlsx, firstrow(variables) sheet (`num', replace) } restore
Comment