Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • putdocx

    I am probably missing something, but I still don't see documentation on how to copy Stata output into a Word, PDF, etc. file using -putdocx- if the output is not in Stata's "etable" format. For example, what about the output after -test-? After -list-,etc?Can anyone shed light on this.I am using Stata 16 IC.

    Thanks

    Al Feiveson

  • #2

    Here are a few examples, not great tables, but perhaps enough to point in the right direction. I assume you are looking at the documentation in the Stata Reporting Reference Manual PDF included in your Stata installation and available through Stata's Help menu.
    Code:
    sysuse auto, clear
    list make price mpg in 1/10
    putdocx begin
    putdocx table t1 = data(make price mpg) in 1/10, varnames
    quietly regress price mpg
    test mpg = 0
    return list
    putdocx table t2 = (2,2)
    putdocx table t2(1,1) = ("F(`r(df)',`r(df_r)')")
    putdocx table t2(1,2) = (r(F))
    putdocx table t2(2,1) = ("Prob > F")
    putdocx table t2(2,2) = (r(p))
    putdocx save "~/Downloads/t1", replace
    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . list make price mpg in 1/10
    
         +------------------------------+
         | make             price   mpg |
         |------------------------------|
      1. | AMC Concord      4,099    22 |
      2. | AMC Pacer        4,749    17 |
      3. | AMC Spirit       3,799    22 |
      4. | Buick Century    4,816    20 |
      5. | Buick Electra    7,827    15 |
         |------------------------------|
      6. | Buick LeSabre    5,788    18 |
      7. | Buick Opel       4,453    26 |
      8. | Buick Regal      5,189    20 |
      9. | Buick Riviera   10,372    16 |
     10. | Buick Skylark    4,082    19 |
         +------------------------------+
    
    . putdocx begin
    
    . putdocx table t1 = data(make price mpg) in 1/10, varnames
    
    . quietly regress price mpg
    
    . test mpg = 0
    
     ( 1)  mpg = 0
    
           F(  1,    72) =   20.26
                Prob > F =    0.0000
    
    . return list
    
    scalars:
                   r(drop) =  0
                   r(df_r) =  72
                      r(F) =  20.25835256291881
                     r(df) =  1
                      r(p) =  .0000254613120514
    
    . putdocx table t2 = (2,2)
    
    . putdocx table t2(1,1) = ("F(`r(df)',`r(df_r)')")
    
    . putdocx table t2(1,2) = (r(F))
    
    . putdocx table t2(2,1) = ("Prob > F")
    
    . putdocx table t2(2,2) = (r(p))
    
    . putdocx save "~/Downloads/t1", replace
    successfully replaced "/Users/lisowskiw/Downloads/t1.docx"
    Click image for larger version

Name:	image_18105.png
Views:	1
Size:	195.5 KB
ID:	1552071

    Last edited by William Lisowski; 08 May 2020, 17:39.

    Comment

    Working...
    X