Announcement

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

  • test post: editing rows and columns of tables

    Hello,

    I've been experimenting with the putdocx command in Stata 15. I read through the documentation and didn't notice a way to apply formatting to an entire row or column of a table (for example, putting the first row in bold). I can do this with a program, but that seems inefficient. Any suggestions?

    Code:
    sysuse auto, replace
    
    capture program drop shadeheader
    program define shadeheader
       syntax name, Col(int)
       forval i = 1/`col' {
          putdocx table `namelist'(1,`i'), bold
       }
    end
    
    putdocx begin, pagesize(letter)
    
    statsby Total=r(N) Average=r(mean) Max=r(max) Min=r(min), by(foreign): summarize mpg
    rename foreign Origin
    
    putdocx paragraph
    putdocx table tbl1 = data("Origin Total Average Max Min"), varnames border(start, nil) border(insideV, nil) border(end, nil)
    shadeheader tbl1, col(5)
    
    putdocx save Test.docx, replace
    Last edited by Jeremy Skog; 15 Jun 2017, 15:13.
Working...
X