Announcement

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

  • Alternative to asdoc for 2 and 3 way tables

    Hi,

    I have been trying to make 2 and 3-way tables for several row variables and export them to a Word file using the asdoc (SSC) package, but the tables are never correctly formatted and are hard to repair as the rows and columns appear to be disjointed. Plus, it allows only one row variable, but I have several variables to report. Is there any alternative way make 3 way tables with multiple variables and export the results to a Word or Excel file?

    Code:
     asdoc tab3way  year urban sex, colpct freq
    I want to add more variables before the columns variables ''urban'' and ''sex''.

    Click image for larger version

Name:	Capture d’écran 2022-05-13 à 09.29.55.png
Views:	1
Size:	178.5 KB
ID:	1664450
    xcel file?

  • #2
    The table command seems to achieve what tab3way can do. And asdoc can export the output from the table command. If you must use tab3way, then it can be implemented in asdocx https://fintechprofessor.com/asdocx/
    Code:
    sysuse auto, clear
        . egen price_cat = cut(price), group(4)
    tab3way price_cat rep78 foreign
    
    ------------------------------------------------------------------------
              |               Car type and Repair Record 1978              
              | --------- Domestic ---------    ---------- Foreign ---------
    price_cat |    1     2     3     4     5       1     2     3     4     5
    ----------+-------------------------------------------------------------
            0 |          4     7     1     1                   1     1     2
            1 |    2           8     2     1                   1     2     1
            2 |          2     5     4                         1     2     4
            3 |          2     7     2                               4     2
    ------------------------------------------------------------------------
    
    . table price_cat rep78 foreign
    
    ------------------------------------------------------------------------
              |               Car type and Repair Record 1978              
              | --------- Domestic ---------    ---------- Foreign ---------
    price_cat |    1     2     3     4     5       1     2     3     4     5
    ----------+-------------------------------------------------------------
            0 |          4     7     1     1                   1     1     2
            1 |    2           8     2     1                   1     2     1
            2 |          2     5     4                         1     2     4
            3 |          2     7     2                               4     2
    ------------------------------------------------------------------------
    
    .
    Regards
    --------------------------------------------------
    Attaullah Shah, PhD.
    Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
    FinTechProfessor.com
    https://asdocx.com
    Check out my asdoc program, which sends outputs to MS Word.
    For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

    Comment


    • #3
      Originally posted by Attaullah Shah View Post
      The table command seems to achieve what tab3way can do. And asdoc can export the output from the table command. If you must use tab3way, then it can be implemented in asdocx https://fintechprofessor.com/asdocx/
      Code:
      sysuse auto, clear
      . egen price_cat = cut(price), group(4)
      tab3way price_cat rep78 foreign
      
      ------------------------------------------------------------------------
      | Car type and Repair Record 1978
      | --------- Domestic --------- ---------- Foreign ---------
      price_cat | 1 2 3 4 5 1 2 3 4 5
      ----------+-------------------------------------------------------------
      0 | 4 7 1 1 1 1 2
      1 | 2 8 2 1 1 2 1
      2 | 2 5 4 1 2 4
      3 | 2 7 2 4 2
      ------------------------------------------------------------------------
      
      . table price_cat rep78 foreign
      
      ------------------------------------------------------------------------
      | Car type and Repair Record 1978
      | --------- Domestic --------- ---------- Foreign ---------
      price_cat | 1 2 3 4 5 1 2 3 4 5
      ----------+-------------------------------------------------------------
      0 | 4 7 1 1 1 1 2
      1 | 2 8 2 1 1 2 1
      2 | 2 5 4 1 2 4
      3 | 2 7 2 4 2
      ------------------------------------------------------------------------
      
      .

      Thanks so much Dr. Attatullah for recommending the package. I will have a look at it.

      For the tabulate command, I want to report both n and %, is it possible to calculate both, if not then just the row % is also fine.
      Please let me know.

      Thank you.

      Comment


      • #4
        The program can do what the table command can do. You can check all the option of the table command by typing
        Code:
        help table
        I thin the table command reports row totals, instead of row percentages
        Regards
        --------------------------------------------------
        Attaullah Shah, PhD.
        Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
        FinTechProfessor.com
        https://asdocx.com
        Check out my asdoc program, which sends outputs to MS Word.
        For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

        Comment


        • #5
          tab3way is now supported by asdocx. See this post for details and examples https://fintechprofessor.com/asdocx/...es-word-excel/
          Regards
          --------------------------------------------------
          Attaullah Shah, PhD.
          Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
          FinTechProfessor.com
          https://asdocx.com
          Check out my asdoc program, which sends outputs to MS Word.
          For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

          Comment

          Working...
          X