Announcement

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

  • Matrix colnames

    Hi all,

    I want to add an additional row in a matrix, which displays the names of grouped columns. The code is:

    Code:
    . mat A = (1,2,3,1,2,3\ 4,5,6,4,5,6\ 7,8,9,7,8,9)
    . matrix rownames A = myrow1 myrow2 myrow3
    . mat colnames A = mycol1  mycol2  mycol3  mycol1  mycol2  mycol3
    . mat coleq A = eq1 eq2
    . mat li A
    
    A[3,6]
                      eq1:          eq2 :          eq2 :          eq2 :          eq2 :          eq2 :
                   mycol1         mycol2   mycol3          mycol2         mycol3         mycol3
    myrow1              1              2              3              1              2              3
    myrow2              4              5              6              4              5              6
    myrow3              7              8              9              7              8              9
    Is there a way to remove the colon and merge/combine top rownames so the appears as following:

    Code:
                                         eq1                          eq2
                        mycol1       mycol2   mycol3          mycol1         mycol2         mycol3
    myrow1              1              2              3              1              2              3
    myrow2              4              5              6              4              5              6
    myrow3              7              8              9              7              8              9
    Thanks.

  • #2
    That sort of spanned column heading is a very Excel-looking presentation. I can sort of think of a way of getting that presentation in Stata, but it's not straightforward.

    Is the ultimate destination of this table Excel, in which case using the capabilities of putexcel (especially those described only in the output of help putexcel_advanced) such as merging cells in the Excel output, would probably be the best approach.

    Comment

    Working...
    X