**# putdocx example webuse nhanes2l, clear putdocx clear putdocx begin putdocx textblock begin, style(Title) Health report putdocx textblock end putdocx textblock begin Below, we load data from the Second National Health and Nutrition Examination Survey (NHANES II) (McDowell et al. 1981). We are interested in how health measures differ across diabetics and non-diabetics. putdocx textblock end dtable age weight bpsystol tcresult tgresult i.sex, by(diabetes, tests) /// title(Table 1) continuous(age weight, test(none)) factor(sex, test(none)) /// nformat(%6.1f mean sd) collect style putdocx, layout(autofitcontents) putdocx collect putdocx textblock begin In this table, we find strong evidence that the mean systolic blood pressure, cholesterol, and triglycerides differ across diabetics and non-diabetics. We visualize how systolic blood pressure changes with age group in <>. We see that systolic blood pressure climbs with age, and for individuals in their 30s and older, those with diabetes have higher blood pressure than those without, on average. putdocx textblock end graph bar (mean) bpsystol, over(agegrp) over(diabetes) /// asyvars blabel(bar, format(%6.1f)) ytitle(Mean systolic blood pressure) graph export graph1.svg, replace putdocx paragraph, halign(center) putdocx text ("Figure 1. Systolic blood pressure and diabetes"), /// bookmark("bmark1") putdocx image graph1.svg, linebreak /// alt("Graph of systolic blood pressure and diabetes") putdocx save report1, replace **# putexcel example webuse census, clear foreach x of varlist pop death marriage { bysort region: egen avg_`x' = mean(`x') } export excel region avg_* pop death marriage state using report2.xlsx, /// firstrow(variables) replace putexcel set report2.xlsx, modify putexcel sheetset, split(1, 4) putexcel save