Announcement

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

  • [Asdoc] Appending 2 tables (with the same row header) into 1

    I want to run some descriptive statistics of sch_q2 by county_name and by SES. After running the below code, I have 2 separate tables with the same row header. Is there any way to append these 2 tables?

    Code:
    asdoc tab sch_q2 county_name, replace save(headteacher)
    asdoc tab sch_q2 SES, append save(headteacher)
    Click image for larger version

Name:	asdoc_tab1.png
Views:	1
Size:	11.5 KB
ID:	1726302

    Append into one table like that
    Click image for larger version

Name:	asdoc_tab2.png
Views:	1
Size:	6.0 KB
ID:	1726303


    Thank you in advance

  • #2
    This is not possible in asdoc. However, the enhanced version of asdoc, i.e. asdocx plus flexmat (which is part of the asdocx system or can be downloaded from SSC) can do it. See the following example.
    Code:
    * Load example data
    sysuse nlsw88
    
    * Create the tables independently
    asdocx tab married race, replace
    asdocx tab married south
    
    * Each table is stored in location 1, 2 and  respectively of the flexmat file system
    * Us the flexmat sub-command merge to merge the two tables
    flexmat merge, matloc(1,2)
    
    asdocx export
    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	30.6 KB
ID:	1726317

    Several user-written commands and Stata official commands for tabulation of categorical variables are supported in asdocx.
    • tabmany – Table of multiple coded answers
    • mrtab – One- and two-way tables of multiple responses
    • tab3way – Three way table of frequencies and percentages
    • tabcount – Tabulates frequencies for up to 7 variables
    • missings – Various utilities for managing missing values
    • tabulate, tab1, tab2
    • pctab – Percentage over a grouping variable


    Last edited by Attaullah Shah; 07 Sep 2023, 08:18.
    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