asdocx with putdocx

Since putdocx allows merging several docx files using the putdocx append command, we can generate files using asdocx with the .docx extension and then merge it with files generated by the putdocx. Below, I perform the following sequence of tasks:

(1) create a file with putdocx command

(2) write some text and regression results to that file using putdocx

(3) save that file

(4) create another file with asdocx

(5) and finally merge the asdocx file to the putdocx file.

*1 Clear putdocx file from memory, if any.
putdocx clear

*2 Load the data set
sysuse auto, clear

*3 Start the putdocx file
putdocx begin

*4 Some putdocx commands
putdocx paragraph, style(Heading1)
putdocx text ("Regression results")

* Write regression results
reg price mpg rep78 headroom trunk length
putdocx table bweight = etable, title("Linear regression of birthweight")

*5 Save the putdocx contents to a file, call it putdocxfil
putdocx save putdocx_file, replace

*6 Write summary statistics with asdocx to a file:name the file as asdocfile
asdocx sum, save(asdocx_file)

*7 Add the asdocx_file to the putdocx_file
putdocx append putdocx_file asdocx_file

The above code generates a combined file that contains the following contents.

word document now contains asdocx and putdocx

Explore more about creating docx in asdocx

To explore more options of creating docx files with asdocx,  you may like to visit:

  Order asdocx

Yearly license of asdocx is available at $9.99. Its life-time license is available at $49.99. With the asdocx membership, you get :

  • Life-time license to use
  • All future updates
  • All premium templates / plugins.
Order asdocx