asdocx: Export from Stata to Word, Excel, LaTeX & HTML Forums asdocx Forum Combine asdocx output with putdocx

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • Aduba Joseph
    Participant
    Post count: 22

    When I combine asdocx with putdocx, the output is usually disarranged. For example, text in a certain paragraph is taken to another paragraph or below another Table.
    In the following code, the text “Case one: Unit cost versus Cumulative Consumption (MWA)” will appear below the second table generated by asdocx instead of the first table that will be generated by asdocx.
    Thanks for your kind effort

    global xvar1 lnCECO1 lnt
    global xvar2 lnCECO1 lnALT lnt
    global xvar3 lnCECO1 lnQt1 lnt
    global xvar4 lnCECO1 lnALT lnQt1 lnt
    global xvar5 lnLC1 lnKC1 lnCECO1 lnt
    global xvar6 lnLC1 lnKC1 lnCECO1 lnALT lnt
    global xvar7 lnLC1 lnKC1 lnCECO1 lnQt1 lnt
    global xvar8 lnLC1 lnKC1 lnCECO1 lnALT lnQt1 lnt
    
    ****************************************************
    putdocx begin
    putdocx paragraph, style(Heading1)
    putdocx text ("Normal input cost")
    putdocx paragraph, style(Heading1)
    putdocx text ("Case one: Unit cost versus Cumulative Consumption (MWA)")
    asdocx xtreg lnCt1 $xvar1, fe robust replace save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest table_layout(autofit)
    asdocx xtreg lnCt1 $xvar2, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    asdocx xtreg lnCt1 $xvar3, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    asdocx xtreg lnCt1 $xvar4, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    asdocx xtreg lnCt1 $xvar5, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    asdocx xtreg lnCt1 $xvar6, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    asdocx xtreg lnCt1 $xvar7, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    asdocx xtreg lnCt1 $xvar8, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    
    putdocx append "C:\Users\aduba\Desktop\LBD_Report.docx"  "C:\Users\aduba\Documents\electricity.docx"
    putdocx save "C:\Users\aduba\Desktop\LBD_Report.docx", append
    
    ****************************************************
    global xvar1 lnCECO2 lnt
    global xvar2 lnCECO2 lnALT lnt
    global xvar3 lnCECO2 lnQt1 lnt
    global xvar4 lnCECO2 lnALT lnQt1 lnt
    global xvar5 lnLC1 lnKC1 lnCECO2 lnt
    global xvar6 lnLC1 lnKC1 lnCECO2 lnALT lnt
    global xvar7 lnLC1 lnKC1 lnCECO2 lnQt1 lnt
    global xvar8 lnLC1 lnKC1 lnCECO2 lnALT lnQt1 lnt
    *****************************************************
    putdocx begin
    asdocx xtreg lnCt1 $xvar1, fe robust replace save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest table_layout(autofit)
    asdocx xtreg lnCt1 $xvar2, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    asdocx xtreg lnCt1 $xvar3, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    asdocx xtreg lnCt1 $xvar4, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    asdocx xtreg lnCt1 $xvar5, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    asdocx xtreg lnCt1 $xvar6, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    asdocx xtreg lnCt1 $xvar7, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    asdocx xtreg lnCt1 $xvar8, fe robust save(electricity) dec(4) stat(p, rmse) fs(8) font(Times New Roman) nest
    
    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    If you want to write formatted text to the same document, you can use asdocx for that. See the following example where I add heading 1 and heading 2 using asdocx, and then add two regressions to the same file.

    sysuse auto
    asdocx, text(Normal input cost) h1 replace
    asdocx, text ("Case one: Unit cost versus Cumulative Consumption (MWA)") h2
    asdocx reg mpg rep78 headroom trunk weight, nest
    asdocx reg mpg rep78 headroom  weight, nest
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.