Forum Replies Created

Viewing 15 posts - 76 through 90 (of 105 total)
  • Author
    Posts
  • Dr. Attaullah Shah
    Keymaster
    Post count: 106

    Hello Greg Hebb
    Thanks for reporting this. I have fixed the bug. Please update asdocx and try the following two examples;

    asdocx_update
    *When using the stat() option
    asdocx ttest Asset , by(bankparent)  replace dec(4)  /// 
        stat(obs mean dif  p) title(T-Test of differences for all Funds) ///
       save(table1all.doc)
    ----+----------------------------------------------------------------------------------------
      1 |                         obs1      obs2     Mean1     Mean2       dif     p_value 
    ----+----------------------------------------------------------------------------------------
      2 |Asset by bankparen~1         4         5     0.001     0.025    -0.024      0.192 
    ---------------------------------------------------------------------------------------------
    
    
    * When option stat() is not used
    asdocx ttest Asset , by(bankparent)  replace dec(4)        ///
        title(T-Test of differences for all Funds) ///
        save(table1all.doc)
    
    
    ----+-------------------------------------------------------------------------------------------
      1 |                       obs1    obs2   Mean1   Mean2     dif    St_Err   t_value    p_value 
    ----+-------------------------------------------------------------------------------------------
      2 |Asset by bankparen~1       4       5   0.001   0.025  -0.024    0.0165     -1.45     0.192 
    ------------------------------------------------------------------------------------------------
    
    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    I have updated asdocx. The current version support the text() option. However, it is still in the development phase and does not have full functionality. It supports the basic case of exporting text in one paragraph. To get the latest version, please type:

    asdocx_update
    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    Hello Ha Thai Son

    I have added option sort with the tabulate command. To get the latest version, please type:

    asdocx_update

    See the following two examples:

    asdocx tab rep78
    
    ----+-----------------------------------------------------------------------------
      1 |Repair Record 1978              Freq.          Percent             Cum. 
    ----+-----------------------------------------------------------------------------
      2 |1                                   2             2.90             2.90 
      3 |2                                   8            11.59            14.49 
      4 |3                                  30            43.48            57.97 
      5 |4                                  18            26.09            84.06 
      6 |5                                  11            15.94           100.00 
      7 |Total                              69           100.00                  
    ----------------------------------------------------------------------------------
     
    * Using option sort
    asdocx tab rep78, sort
     
    ----+-----------------------------------------------------------------------------
      1 |Repair Record 1978              Freq.          Percent             Cum. 
    ----+-----------------------------------------------------------------------------
      2 |3                                  30            43.48            43.48 
      3 |4                                  18            26.09            69.57 
      4 |5                                  11            15.94            85.51 
      5 |2                                   8            11.59             97.1 
      6 |1                                   2             2.90              100 
      7 |Total                              69           100.00                  
    ----------------------------------------------------------------------------------
    
    
    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    Hello Greg Hebb
    Can you please post an example data and code so that I replicate the issue at my end.

    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    For this type of tables, the flexmat program is ideal. If you need such tables on frequent basis, you can create a custom template and use it conveniently. Below I show how to make this table piece by piece , using various functionalities of flexmat. Please do update asdocx before using the following solution.

     * To update asdocx
    asdocx_update
    clear
    input str21 prod str7 Country float(ym rel_px)
    "Allitems" "Ireland" 648  34.88717
    "Allitems" "Ireland" 649  26.68857
    "Allitems" "Ireland" 650  13.66463
    "Allitems" "Ireland" 651  2.855687
    "Allitems" "Ireland" 652  86.89333
    "Allitems" "Ireland" 653  35.08549
    "Allitems" "Ireland" 654  7.110509
    "Allitems" "Ireland" 655 32.336796
    "Allitems" "Ireland" 656  55.51031
    "Allitems" "Ireland" 657   87.5991
    "Allitems" "Ireland" 658  20.47095
    "Allitems" "Ireland" 659  89.27587
    "Allitems" "Ireland" 660  58.44658
    "Allitems" "Ireland" 661 36.977913
    "Allitems" "Ireland" 662  85.06309
    "Allitems" "Ireland" 663  39.13819
    "Allitems" "Ireland" 664  11.96613
    "Allitems" "Ireland" 665  75.42434
    "Allitems" "Ireland" 666 69.502335
    "Allitems" "Ireland" 667  68.66152
    "Allitems" "Ireland" 668  93.19346
    "Allitems" "Ireland" 669  45.48882
    "Allitems" "Ireland" 670   6.74011
    "Allitems" "Ireland" 671  33.79889
    "Allitems" "Ireland" 672  97.48848
    "Allitems" "Ireland" 673  72.64384
    "Allitems" "Ireland" 674 4.5415115
    "Allitems" "Ireland" 675 74.596664
    "Allitems" "Ireland" 676  49.61259
    "Allitems" "Ireland" 677 71.671616
    "Allitems" "Ireland" 678  85.97421
    "Allitems" "Ireland" 679 13.407556
    "Allitems" "Ireland" 680  48.84418
    "Allitems" "Ireland" 681  87.12188
    "Allitems" "Ireland" 682  76.64684
    "Allitems" "Ireland" 683 25.125553
    "Allitems" "Ireland" 684 16.636478
    "Allitems" "Ireland" 685 74.379585
    "Allitems" "Ireland" 686  98.05113
    "Allitems" "Ireland" 687  72.95772
    "Allitems" "Ireland" 688  90.11049
    "Allitems" "Ireland" 689 26.436493
    "Allitems" "Ireland" 690  88.56509
    "Allitems" "Ireland" 691   88.2112
    "Allitems" "Ireland" 692 74.893295
    "Allitems" "Ireland" 693  91.96262
    "Allitems" "Ireland" 694  69.34533
    "Allitems" "Ireland" 695  21.54026
    "Allitems" "Ireland" 696  82.85889
    "Allitems" "Ireland" 697 4.4215355
    "Allitems" "Ireland" 698  86.30377
    "Allitems" "Ireland" 699 35.260456
    "Allitems" "Ireland" 700  77.20399
    "Allitems" "Ireland" 701  58.61199
    "Allitems" "Ireland" 702 32.277664
    "Allitems" "Ireland" 703 17.293066
    "Allitems" "Ireland" 704  80.53645
    "Allitems" "Ireland" 705  30.60019
    "Allitems" "Ireland" 706  21.90997
    "Allitems" "Ireland" 707   72.4731
    "Allitems" "Ireland" 708  69.64866
    "Allitems" "Ireland" 709  91.19344
    "Allitems" "Ireland" 710 67.956345
    "Allitems" "Ireland" 711  35.49416
    "Allitems" "Ireland" 712    73.897
    "Allitems" "Ireland" 713 18.740166
    "Allitems" "Ireland" 714  31.46128
    "Allitems" "Ireland" 715  13.75693
    "Allitems" "Ireland" 716  65.37739
    "Allitems" "Ireland" 717 27.013193
    "Allitems" "Ireland" 718  89.98394
    "Allitems" "Ireland" 719  57.34232
    "Allitems" "Ireland" 720 11.147037
    "Allitems" "Ireland" 721  41.45227
    "Allitems" "Ireland" 722  .3052204
    "Allitems" "Ireland" 723  66.59978
    "Allitems" "Ireland" 724 34.628757
    "Allitems" "Ireland" 725  7.802349
    "Allitems" "Ireland" 726 12.758135
    "Allitems" "Ireland" 727  22.97006
    "Allitems" "Ireland" 728 32.955467
    "Bread"    "Ireland" 648  41.44089
    "Bread"    "Ireland" 649  3.608474
    "Bread"    "Ireland" 650  8.438108
    "Bread"    "Ireland" 651  .9876246
    "Bread"    "Ireland" 652  32.00437
    "Bread"    "Ireland" 653 .51969653
    "Bread"    "Ireland" 654 22.754347
    "Bread"    "Ireland" 655   85.1468
    "Bread"    "Ireland" 656  98.20066
    "Bread"    "Ireland" 657 3.2479186
    "Bread"    "Ireland" 658  98.74847
    "Bread"    "Ireland" 659  89.41061
    "Bread"    "Ireland" 660  96.84734
    "Bread"    "Ireland" 661  23.92203
    "Bread"    "Ireland" 662  69.27336
    "Bread"    "Ireland" 663  48.84359
    "Bread"    "Ireland" 664  43.76452
    "Bread"    "Ireland" 665  58.58005
    "Bread"    "Ireland" 666 37.870922
    "Bread"    "Ireland" 666 37.870922
    "Allitems" "Ireland" 648  68.80603
    "Allitems" "England" 649  97.94578
    "Allitems" "England" 650  67.01937
    "Allitems" "England" 651  59.48808
    "Allitems" "England" 652  79.70892
    "Allitems" "England" 653  78.35854
    "Allitems" "England" 654  65.46342
    "Allitems" "England" 655  9.688908
    "Allitems" "England" 656 68.850586
    "Allitems" "England" 657   87.2496
    "Allitems" "England" 658  52.96353
    "Allitems" "England" 659  83.02209
    "Allitems" "England" 660  93.39853
    "Allitems" "England" 661 17.498913
    "Allitems" "England" 662  55.36171
    "Allitems" "England" 663  53.46152
    "Allitems" "England" 664  77.67793
    "Allitems" "England" 665  12.88747
    "Allitems" "England" 666  27.75184
    "Allitems" "England" 667  42.42016
    "Allitems" "England" 668 13.590055
    "Allitems" "England" 669  33.25624
    "Allitems" "England" 670  46.75523
    "Allitems" "England" 671  51.60881
    "Allitems" "England" 672  6.694305
    "Allitems" "England" 673  7.229638
    "Allitems" "England" 674  68.17465
    "Allitems" "England" 675  8.804953
    "Allitems" "England" 676 13.270818
    "Allitems" "England" 677  87.45816
    "Allitems" "England" 678  24.68877
    "Allitems" "England" 679 4.3254995
    "Allitems" "England" 680 37.644367
    "Allitems" "England" 681  76.77862
    "Allitems" "England" 682 75.513664
    "Allitems" "England" 683  44.76189
    "Allitems" "England" 684  40.87105
    "Allitems" "England" 685 29.777426
    "Allitems" "England" 686  67.94177
    "Allitems" "England" 687  71.24024
    "Allitems" "England" 688  56.62265
    "Allitems" "England" 689 17.783249
    "Allitems" "England" 690 11.399897
    "Allitems" "England" 691  59.55869
    "Allitems" "England" 692  62.51604
    "Allitems" "England" 693  63.48989
    "Allitems" "England" 694  99.44572
    "Allitems" "England" 695 74.976776
    "Allitems" "England" 696 17.367882
    "Allitems" "England" 697  61.07705
    "Allitems" "England" 698  57.54215
    "Allitems" "England" 699 36.781612
    "Allitems" "England" 700 30.052456
    "Allitems" "England" 701  .7538024
    "Allitems" "England" 702  67.01369
    "Allitems" "England" 703  42.41406
    "Allitems" "England" 704  95.37622
    "Allitems" "England" 705  8.674778
    "Allitems" "England" 706  89.49648
    "Allitems" "England" 707  58.90286
    "Allitems" "England" 708  40.05832
    "Allitems" "England" 709  66.54901
    "Allitems" "England" 710  41.98386
    "Allitems" "England" 711 74.720535
    "Allitems" "England" 712 71.901436
    "Allitems" "England" 713  84.64647
    "Allitems" "England" 714  79.08313
    "Allitems" "England" 715 19.002222
    "Allitems" "England" 716  38.69604
    "Allitems" "England" 717 23.871336
    "Allitems" "England" 718 34.470016
    "Allitems" "England" 719  77.95682
    "Allitems" "England" 720 74.843956
    "Allitems" "England" 721 23.037836
    "Allitems" "England" 722 16.770323
    "Allitems" "England" 723  91.80508
    "Allitems" "England" 724  31.38996
    "Allitems" "England" 725  90.19141
    "Allitems" "England" 726  7.740517
    "Allitems" "England" 727  63.41382
    "Allitems" "England" 728  81.47295
    "Bread"    "England" 648  87.88922
    "Bread"    "England" 649  2.599352
    "Bread"    "England" 650 17.993002
    "Bread"    "England" 651  57.78895
    "Bread"    "England" 652  40.81415
    "Bread"    "England" 653  61.55495
    "Bread"    "England" 654 17.457695
    "Bread"    "England" 655 36.176464
    "Bread"    "England" 656  13.38996
    "Bread"    "England" 657  .1363096
    "Bread"    "England" 658 25.710005
    "Bread"    "England" 659  65.17417
    "Bread"    "England" 660  92.52081
    "Bread"    "England" 661  82.33367
    "Bread"    "England" 662  92.29402
    "Bread"    "England" 663  74.80426
    "Bread"    "England" 664  52.14148
    "Bread"    "England" 665  40.22151
    end
    format %tm ym
    

    And now the code to generate the table

    * Make first part of the table
    asdocx tabulate prod if Country=="Ireland" & ym<676, summarize(rel_px) replace
    
    * Run the command again for sub sample of England
    asdocx tabulate prod if Country=="England" & ym<676, summarize(rel_px)
    
    * Append this second table to the right of the first, deleting the row names
    flexmat addmat, matname(output)  right norownames 
    
    * Delect the second table
    flexmat droploc, loc(2)
    
    * Make the third part of the table
    asdocx tabulate prod if Country=="Ireland" & ym>=676, summarize(rel_px) 
    
    * Append this new table below the main table 
    flexmat addmat, matname(output)  below 
    flexmat droploc, loc(2)
    
    
    asdocx tabulate prod if Country=="England" & ym>=676, summarize(rel_px)
    flexmat addmat, matname(output)  row(4) col(5) norownames 
    flexmat droploc, loc(2)
    
    * Add super row
    flexmat addrow, data(\hmerge_7 Post-Tax) above
    
    * Add sub row
    flexmat insertrow, data(\hmerge_3 England) row(2)
    flexmat addrow, data(\hmerge_4 Ireland) row(2) col(5)
    
    * Panel seperator
    flexmat insertrow, data(\hmerge_7 Post-Tax) row(6)
    
    asdocx exportflex

    asdocx flexmat

    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    Hello Daniel
    Concerning the error, please update asdocx with

    asdocx_update

    and it should fix the error.

    To solve the formating issue, please use tzok option with format(%20.3f) or any other valid Stata format. See the following example

    sysuse auto
    replace price = price * 1000000
    asdocx ttest price if make != "Toyota Corona", label abb(.)  save(test) format(%20.3f) replace tzok
    Table: Results
    
     ---+---------------------------------------------------------------------------------------------
      1 |                    obs                  Mean                St_Err      t_value      p_value 
    ----+---------------------------------------------------------------------------------------------
      2 | Price           73.000        6171369863.014         347546171.778       17.757        0.000 
    --------------------------------------------------------------------------------------------------

    The following tables shows examples of different available formatting options.

         Four values displayed in different numeric display formats
        +---------------------------------------------------------------------+
        |   %9.0g   %9.0gc     %9.2f     %9.2fc %-9.0g       %09.2f     %9.2e |
        |---------------------------------------------------------------------|
        |   12345   12,345  12345.00  12,345.00  12345    012345.00  1.23e+04 |
        |  37.916   37.916     37.92      37.92  37.916   000037.92  3.79e+01 |
        | 3567890  3567890  3.57e+06   3.57e+06  3567890   3.57e+06  3.57e+06 |
        |   .9165    .9165      0.92       0.92  .9165    000000.92  9.16e-01 |
        +---------------------------------------------------------------------+
    
    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    Please update asdocx and try the following example:

    asdocx_update
    
    * Reset any previous matrix
    flexmat reset
    
    * Add data through addcell command
    flexmat addcell, data(Year) r(1) c(1)
    flexmat addcell, data(Mean) r(1) c(2)
    flexmat addcell, data(SD)   r(1) c(3)
    flexmat addcell, data(2001) r(2) c(1)
    flexmat addcell, data(1.5%) r(2) c(3)
    flexmat addcell, data(1.5%) r(2) c(3)
    flexmat addcell, data(5.1%) r(2) c(2)
    
    * Add more data through addrow command
    flexmat addrow, data(2002, 6.74, 1.68) row(3) col(1)
    flexmat addrow, data(2003, 6.58, 1.61) row(4) col(1)
    
    * Start a new matrix at location 2
    flexmat addrow, data(Year, P75) loc(2)
    flexmat addrow, data(2001, 4%) loc(2) row(2)
    flexmat addrow, data(2004, 9.3) loc(2) row(3)
    
    * Merge the matrices at location 1 and two
    flexmat merge, matloc(1,2)
    
     0 |1                          2                   3                   4 
    ----+-----------------------------------------------------------------------------
      1 |Year                    Mean                  SD                 P75 
    ----+-----------------------------------------------------------------------------
      2 |2001                    5.1%                1.5%                  4% 
      3 |2002                    6.74                1.68                     
      4 |2003                    6.58                1.61                     
      5 |2004                                                             9.3 
    ----------------------------------------------------------------------------------
    
    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    Please update asdocx and re-try.

    asdocx_update
    

    The string issue should be solved. For reporting comma separators with thousands, use the option spe000. See example

    sysuse auto, clear
    asdocx sum, sep000 replace
    

    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    Nesting is possible using the merge sub-command of the flexmat. See examples on this page (Section 10. merge) https://asdocx.com/flexmat-create-flexible-tables-in-stata-mata/. However, it is must that you have the row names exactly the same for rows that needs to be nested.

    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    Please update asdocx and try the code that I have given above. If it does not work, you can report the error message from it. If it works but does not work on your sample or code, then please post the code that you are using and the example dataset that can replicate the given error. You can post example dataset using the dataex program (available on ssc)

    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    Daniel, please post data example using the dataex command so that I can replicate the problem at my end. If dataex is not installed, then you can install it from the SSC/

    ssc install dataex
    dataex
    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    Hi Isabel
    Perhaps, there is a spelling mistake in the sub-command wmat. The error message shows what, not wmat. Here is a working example.

    webuse nlswork, clear
    mixed ln_w grade age c.age#c.age ttl_exp tenure c.tenure#c.tenure || id:
    estadd beta
    matrix b = e(beta)
    matrix betas = b'
    asdocx wmat, mat(betas) right dec(3)
    
    
      0 |1                                                           2 
    ----+-----------------------------------------------------------------------------
      1 |                                                           y1 
    ----+-----------------------------------------------------------------------------
      2 |grade                                                   0.345 
      3 |age                                                     0.446 
      4 |c.age#c.age                                                .z 
      5 |ttl exp                                                 0.343 
      6 |tenure                                                  0.291 
      7 |c.tenure#c.tenure                                          .z 
      8 | cons                                                      .z 
      9 | cons                                                      .z 
     10 | cons                                                      .z 
    ----------------------------------------------------------------------------------
    
    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    Hello Professor River
    I have replied to your post on the Statalist

    Regards

    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    If you just need the mean for each industry, then you use the option stat(). See for example:

    sysuse nlsw88, clear
    bys industry : asdocx sum wage, stat(mean) replace
    
    ----+---------------------------------
      1 |                            wage 
    ----+---------------------------------
      2 |Ag/Forestry/Fisheries      5.621 
      3 |Business/Repair Svc        7.516 
      4 |Construction               7.565 
      5 |Entertainment/Rec ~c       6.724 
      6 |Finance/Ins/Real E~e       9.843 
      7 |Manufacturing              7.502 
      8 |Mining                     15.35 
      9 |Personal Services          4.401 
     10 |Professional Servi~s       7.871 
     11 |Public Administrat~n       9.148 
     12 |Transport/Comm/Uti~y      11.443 
     13 |Wholesale/Retail T~e       6.126 
    --------------------------------------
    
    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    I have added margins to asdocx. Now you can report a detailed table or margins [see this post ] or a nested table of margins [see this post ]

Viewing 15 posts - 76 through 90 (of 105 total)