clear capture log close log using "$pathlog\13_Commercial Schedule 135 Margin of Error Tally_$S_DATE.log",replace forvalues x=1/12{ forvalues y=48/59{ quietly append using "$pathout135com\04_Schedule 135 Commercial Montly Interval Total Exports_`x'_`y'_14 Jul 2020.dta" } } drop if Exports_moe_pe==. count if Exports_moe_pe<.1 gen moe_100=Exports_moe_pe * 100 sum moe_100,d sum moe_100 if Peak==1,d rename *,lower sort month order collapse (mean) moe_100 export excel moe_100 using "$pathexcelsurr\Exhibit 2-AJL.xlsx",sheetmodify sheet("Sch 135 Com")cell(A2), putexcel set "$pathexcelsurr\Exhibit 2-AJL.xlsx",sheet("Sch 135 Com") modify putexcel A1="Margin as a Percentage", bold save "$pathout135com\13_combined schedule 135 commercial moe_$S_DATE.dta",replace log close