asdocx: Export from Stata to Word, Excel, LaTeX & HTML Forums asdocx Forum Problem in getting Stata matrix to flexmat | asdocx

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • Luis Pecht
    Participant
    Post count: 7

    Professor, for some reason, cell(1,1,) was not capture from source matrix’s data. Note header “age” in the example below:

    . webuse nhanes2d , clear
    . qui probit highbp age age2 race hct diabetes [pw=weight], robust
    . flexmat reset
    . mat table= e(b)
    . matrix list table
    
    table[1,6]
            highbp:     highbp:     highbp:     highbp:     highbp:     highbp:
               age        age2        race         hct    diabetes       _cons
    y1   .04928051  -.00023041   .24378614   .04189565    .2340447  -3.9646881
    
    . flexmat addmat, matname(table) dec(1)
    
    
       
      0 |1                            2              3              4              5              6 
    ----+--------------------------------------------------------------------------------------------
      1 |\                         age2           race            hct       diabetes          _cons 
    ----+--------------------------------------------------------------------------------------------
      2 |      0.0                 -0.0            0.2            0.0            0.2           -4.0 
    --------------------------------------------------------------------------------------------------
    
    . which flexmat
    
    *! Attaullah Shah : version 1.5: June 7, 2021
    *! flexmat Version 1.5: June 7, 2021 : dropcol and droprow now accepts range row(1-4), col(2-4) or list row(1,3,5)
    *! Version 1: addrow is a subcommand in asdocmat to add row; Attaullah Shah: Sep 9, 2018
    *! addcol: Version 1: addcol is a subcommand in asdocmat to add row; Attaullah Shah: Sep 9, 2018
    *! asdocdec: Handle decimal points: Attaullah Shah : Feb20, 2018
    

    any clue ? thks

    Attaullah Shah
    Moderator
    Post count: 76

    This issue is now fixed in the asdocx beta version. I have added the new features to the beta version of asdocx. All new features are first added to the beta version. Once that version is stable, it is released as a regular version. To install the new version, copy and paste the following line in Stata and press enter.

    asdocx_update, beta

    Restart Stata after installation of the new version.

    Here is an example

    mat A = (1,2,3\ 4,5,6\ 7,8,9)
    matrix rownames A = myrow1 myrow2 myrow3
    mat colnames A = mycol1 mycol2 mycol3
    flexmat addmat, matname(A)
     0 |1                           2                3                4 
    ----+--------------------------------------------------------------------
      1 |                       mycol1           mycol2           mycol3 
    ----+---------------------------------------------------------------------
      2 |myrow1                      1                2                3 
      3 |myrow2                      4                5                6 
      4 |myrow3                      7                8                9 
    ---------------------------------------------------------------------------
    
    Luis Pecht
    Participant
    Post count: 7

    Thanks, Professor,

    my last comment is that, after generating the flexmat file, the ASDOCX command is ignoring the title/note option:

    . asdocx exportflex, save("Myfile.docx") title("Title here") note(note goes here) replace
    Click to Open File:  Myfile.docx 

    in Myfile.docx:

    Table: Results --- default title
    	mycol1	mycol2	mycol3
    myrow1	1	2	3
    myrow2	4	5	6
    myrow3	7	8	9
    Attaullah Shah
    Moderator
    Post count: 76

    This is documented in the flexmat help file.

     help flexmat 

    Section 9 of the help file reads
    9. addparts:
    Sub-command addparts with option notes(Table notes text) adds table notes to the current table. Table notes appear at the bottom of the
    table when the table is exported with asdocx. When sub-command addparts is used with option title(Table title text), it sets the table
    title.

    flexmat reset
    mat A = (1,2,3\ 4,5,6\ 7,8,9)
    matrix rownames A = myrow1 myrow2 myrow3
    mat colnames A = mycol1 mycol2 mycol3
    flexmat addmat, matname(A)
    flexmat addparts, title(My Stata matrix) notes(My notes from flexmat)
    
    
                                    My Stata matrix
      0 |1                           2                3                4 
    ----+------------------------------------------------------------------
      1 |                       mycol1           mycol2           mycol3 
    ----+-------------------------------------------------------------------
      2 |myrow1                      1                2                3 
      3 |myrow2                      4                5                6 
      4 |myrow3                      7                8                9 
    ------------------------------------------------------------------------
    My notes from flexmat
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.