asdocx: Export from Stata to Word, Excel, LaTeX & HTML Forums asdocx Forum Two-way Tab Missing Frequencies with matcell() Option Invoked

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • Kevin Blaine
    Participant
    Post count: 50

    I’m encountering an issue on a tab command: if I include the matcell() option, the resulting output is this:

    asdocx tab flu approach_ablation, chi save(Abstract Tables) replace column matcell(flu) tzok dec(2) title(\i)
    
                                             \i
      0 |1                                                        2 
    ----+-----------------------------------------------------------------------------
      1 | Fluoroscopy Needed?                     Ablation Approach 
      2 |                                                     Total 
    ----+-----------------------------------------------------------------------------
      3 |Total                                                 0.00 
      4 |                                                         . 
      5 |Pearson Chi2                                        33.65  
      6 |Prob.                                               0.0000 
    ----------------------------------------------------------------------------------
    Notes:
    
    

    However, the moment I remove that matcell() option, everything works fine. User error?

    Thanks!

    Attaullah Shah
    Moderator
    Post count: 76

    asdocx uses matcell(), matrow() and matcol() internally to constructs the frequency table. Therefore, users cannot use these options. If you must use these options and also need asdocx with tab command, the workaround is use the tab command twice: once with asdocx and second without asdocx. In the second case, you may added these options.

    Kevin Blaine
    Participant
    Post count: 50

    That makes total sense. Thanks for the quick reply!

    Kevin Blaine
    Participant
    Post count: 50

    Hi again — I’m still running into issues, even without the matcell() option invoked: only percents show up, not frequencies:

    
    asdocx tab pre_ice flu, row save($Results/test) replace nokey
    
                                 Tabulation of pre_ice flu
      0 |1                                                      2            3            4 
    ----+-----------------------------------------------------------------------------------------
      1 | Learning Era of ICE                 Fluoroscopy Needed?                           
      2 |                                                      No          Yes        Total 
    ----+-----------------------------------------------------------------------------------------
      3 |No                                                23.913       76.087          100 
      4 |                                                                                   
      5 |Yes                                                6.667       93.333          100 
      6 |                                                                                   
      7 |Total                                             19.672       80.328          100 
      8 |                                                                                   
    ----------------------------------------------------------------------------------------------
    Notes:
      
    Click to Open File:  /XXX
    
    

    What am I doing wrong?

    Kevin Blaine
    Participant
    Post count: 50

    Just to keep things as simple as possible, the same thing happens on the BPWide example dataset (no frequencies):

    
    
    clear all
    
    sysuse bpwide
    (Fictional blood-pressure data)
    
    cd "/Users/Default/Downloads"
    /Users/Default/Downloads
    
    asdocx tab sex agegrp, row save(test) replace
    
    +----------------+
    | Key            |
    |----------------|
    |   frequency    |
    | row percentage |
    +----------------+
    
               |            Age group
           Sex |     30-45      46-59        60+ |     Total
    -----------+---------------------------------+----------
          Male |        20         20         20 |        60 
               |     33.33      33.33      33.33 |    100.00 
    -----------+---------------------------------+----------
        Female |        20         20         20 |        60 
               |     33.33      33.33      33.33 |    100.00 
    -----------+---------------------------------+----------
         Total |        40         40         40 |       120 
               |     33.33      33.33      33.33 |    100.00 
          - mata: write_full_matrix("`matname'", "`file'", `loc')
          = mata: write_full_matrix("/Users/Default/Downloads/_asdoc/current_file.asdoc", "/Users/Default/Downloads/_asdoc/test.flexmat", 1)
          - set trace off
    
    
       
                                  Tabulation of sex agegrp
      0 |1                             2          3          4          5 
    ----+------------------------------------------------------------------------------
      1 | Sex                  Age group                                  
      2 |                          30-45      46-59        60+      Total 
    ----+------------------------------------------------------------------------------
      3 |Male                     33.333     33.333     33.333        100 
      4 |                                                                 
      5 |Female                   33.333     33.333     33.333        100 
      6 |                                                                 
      7 |Total                    33.333     33.333     33.333        100 
      8 |                                                                 
    -----------------------------------------------------------------------------------
    Notes:
    
    Click to Open File:  /Users/Default/Downloads/test.docx
    
    

    Can you replicate the issue?

    Kevin Blaine
    Participant
    Post count: 50

    Hello! Just following up on this. Thanks!

    Attaullah Shah
    Moderator
    Post count: 76

    Thanks for reporting this. I have fixed it now. Please update and test the new version.

    asdocx_update
    
    webuse citytemp2, clear
    
    asdocx tab region agecat, row   replace
    
                           Tabulation of region agecat
      0 |1                                        2            3           4           5 
    ----+-------------------------------------------------------------------------------------
      1 | Census region                Age category                                      
      2 |                                     19–29        30–34         35+       Total 
    ----+-------------------------------------------------------------------------------------
      3 |NE                                      46           83          37         166 
      4 |                                    27.711           50      22.289         100 
      5 |N Cntrl                                162           92          30         284 
      6 |                                    57.042       32.394      10.563         100 
      7 |South                                  139           68          43         250 
      8 |                                      55.6         27.2        17.2         100 
      9 |West                                   160           73          23         256 
     10 |                                      62.5       28.516       8.984         100 
     11 |Total                                  507          316         133         956 
     12 |                                    53.033       33.054      13.912         100 
    ------------------------------------------------------------------------------------------
    Notes: First row has frequencies, and second row has row percentages.
    
    Kevin Blaine
    Participant
    Post count: 50

    This works! THANK YOU SO MUCH!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.