I am trying to create a word document with a number of histograms. I would like to describe each histogram with text using the variable label. I know that putdocx allows you to use functions and expressions from the documentation. I looked at the documentation for functions and expressions. It only has a documentation about label values (13.11). But I also know that I can extract the variable label using the local approach. So, I am wondering if it is possible to use variable label in putdocx text.
Crossposted on Stackoverflow.
Code:
use https://www.stata-press.com/data/r17/nlsw88.dta histogram age graph export "path/histogram.age.png", replace as(png) ** Using local to store the variable label local age_lab: variable label age di "`age_lab'" putdocx begin putdocx paragraph, style(Heading1) putdocx text ("Histogram of `age_lab'") putdocx image ("histogram.age.png") putdocx save histogramreport, replace
Comment