Announcement

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

  • problem with tab and tab asdoc

    Hey,

    I working on a panel dataset with observations of about 70 countries from 1995 to 2018. I'm trying to export some summary stats to word but things are not really working as I expected, I hope some of you can help.

    First I want the mean of U_n for every country including std. dev. and min and max.

    Code:
    tab country, sum(U_n)
    With this code I get the mean and std. dev. for every country but not min and max. After that I tried the following code to export the table, but then I don't get the mean of U_n and the std. dev.

    Code:
    asdoc tab country, sum(U_n) by  save(country level descriptive stats.doc) replace
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte country_ID str14 country int year double(U_n U_EX_n U_IM_n GDP_growth)
    39 "ARG" 2010 1.795919768381876 1.938292761010062 .9949282732576962  10.125398156100232
    39 "ARG" 2004  1.99984531388201 2.100991250979231 1.230618766858952    9.02957330068152
    39 "ARG" 1999 1.564418863222329 1.642647228460741  .598653858126375  -3.385457040632687
    39 "ARG" 1995 1.585989505338026 1.657552233577758 .5948923018769351  -2.845209610570791
    39 "ARG" 2005 1.858531182092373 1.989805545933745 1.031626445175866   8.851659920134367
    39 "ARG" 2009 1.816000036984908 1.954836504572253 1.007035397915684  -5.918525076349468
    39 "ARG" 1997 1.628247419168692 1.783315424855554 .6571015649211819   8.111046770745702
    39 "ARG" 2003 1.867833855067372  1.97131004208871 1.047596606950255    8.83704079576924
    39 "ARG" 1996 1.591924982006316 1.658327061042265 .6168719141848061   5.526689827152339
    39 "ARG" 2006 1.849388274807675 1.977480048565057 1.015234942831938   8.047151500430274
    39 "ARG" 1998 1.577741130689289 1.651436962909676 .6047701604983508  3.8501788515622764
    39 "ARG" 2001 1.602843905805536 1.713366220080501 .6726727273847416  -4.408839682585565
    39 "ARG" 2016 1.738793572588566 1.888998836504688 .8848480707833909 -2.0803278437781074
    39 "ARG" 2018 1.734827622615454 1.852211573851433 .8542338335073931 -2.6173964628203805
    39 "ARG" 2017 1.720956190609813 1.875822949114524 .8515997068582241   2.818502977759181
    39 "ARG" 2002 1.867630087900578 1.966456668402629 1.024299281160805  -10.89448482859028
    39 "ARG" 2008 1.848436684470838 1.999088847073375 1.016590624682729   4.057233103464057
    39 "ARG" 2015 1.732046898718725 1.890885505397549  .929174253722495   2.731159828289435
    39 "ARG" 2007 1.852614829073472 1.988999072914671 1.012754286869907   9.007650875047574
    39 "ARG" 2011  1.79276725498986 1.946086139075282  1.00636877471075   6.003951692805785
    39 "ARG" 2012 1.793457166358365 1.957763923261628   1.0159969484504  -1.026420454432099
    39 "ARG" 2013 1.768020037151199 1.925565752740251 .9762235871788749  2.4053237807943617
    39 "ARG" 2014 1.760906206775917 1.910416023212276 .9619578958540397 -2.5126153208139357
    39 "ARG" 2000 1.594913153870353  1.70153002034142 .6450163817048269  -.7889989390569099
     1 "AUS" 1999 2.004806423590861 2.226132494424733 1.005802412724161   4.936674928162603
     1 "AUS" 2001 2.073052533635971 2.289690828433103 1.066540187695987   2.038300731735305
     1 "AUS" 2013 2.124489946544033 2.545690862236604 1.020912097319993  2.6002118806565306
     1 "AUS" 2015  2.15769476875158 2.583655517018864 1.017392679674546    2.17220475337416
     1 "AUS" 1996 1.995907463378433 2.223213918091118 1.000534420956923   3.854419962835152
     1 "AUS" 2018 2.172924262913508 2.605166417759552 .9924447074779456   2.870972480216679
     1 "AUS" 1998 1.999832510491528 2.235237833375236 .9966713293657296  4.6140115756183775
     1 "AUS" 2010 2.092884042684974 2.470157664284242 1.022327904485397   2.172337091016246
     1 "AUS" 2000 2.030767992157176 2.255800497281128 1.029007692024155   3.912427732711876
     1 "AUS" 2005 2.063358807072253 2.335931977325884 1.013452636737121   3.160338325106153
     1 "AUS" 2002 2.047506508799126 2.258340665317926 1.057514676453032   4.014526653755212
     1 "AUS" 2016 2.125593585207299 2.527039412054345 .9408168677904674  2.7416430686472353
     1 "AUS" 1997 1.994124833763246 2.219270533508554 .9778499645960586   3.908290893401059
     1 "AUS" 2009 2.118587020698358 2.501554025368447  1.11580182990839  1.8668320701175958
     1 "AUS" 2012 2.150509654173741 2.589211517718778 1.060344756302252   3.917362463285045
     1 "AUS" 2007  2.09372388442839 2.431367892427397 1.037362560012205  3.7684875158189044
     1 "AUS" 2003 2.047136171762056 2.282784308915272 1.035065026446991  3.1103251090279826
     1 "AUS" 2017 2.151294718245365 2.539596706632298 .9556909294161645   2.295926946940625
     1 "AUS" 2006 2.085913894542541 2.405926397773695 1.025387201545136  2.7268934458503793
     1 "AUS" 2004 2.049438329918653 2.290303551632734 .9966730196463452   4.205446886862646
     1 "AUS" 2011 2.148470642385466 2.576316766764549 1.060128407405739   2.469746293817309
     1 "AUS" 2014 2.159993095344821 2.619471475840255 1.070834659570781   2.562931520833885
     1 "AUS" 2008 2.117492653193374 2.469195796776042 1.048587238596614  3.5770148781477644
     1 "AUS" 1995 1.964238171108053   2.2020037229861  .974106642028384   3.833830589055083
     2 "AUT" 2000 1.850133497897766 2.017472317991881 1.032418729769579  3.3757221470847867
     2 "AUT" 2007 2.008816109438739 2.150894045231163 1.206530664357367   3.727415300935192
     2 "AUT" 1995 1.763498450298662 1.912792297059575 .9196629833510872  2.6679835308954836
     2 "AUT" 2005 1.942691837841682 2.101650101353158 1.155445627576439  2.2440653246387825
     2 "AUT" 2008 2.057180453301043 2.190908869020619 1.244710487311596  1.4604236757385962
     2 "AUT" 1999 1.805700922625803 1.963745770900521 .9696782943673133  3.5563312466416903
     2 "AUT" 2010  2.03341147634785 2.169658622567229 1.225911413869548   1.837093676800535
     2 "AUT" 2015 2.045685225628958 2.200940573902537 1.252589470269349  1.0145015859051085
     2 "AUT" 2013 2.053220666268402 2.197597195248221  1.27806666158268 .025504712197218282
     2 "AUT" 2016 2.008386988546712 2.159179315857593 1.196857406621691  1.9894371623046254
     2 "AUT" 2001 1.867537551898842 2.028853660931054 1.061014800036804  1.2671681892299205
     2 "AUT" 2011 2.054375731778452 2.191250324664368 1.265813829266337    2.92279728368581
     2 "AUT" 2018 2.029844240138667 2.167465912229915 1.236136284410214   2.501595118720857
     2 "AUT" 1997  1.78412209299925 1.948289344194004 .9472254222332163  2.0935993895239164
     2 "AUT" 2012 2.056693285481736 2.196311054194236 1.284720468842974    .680445576816723
     2 "AUT" 2009 2.008462925708366 2.146345607061902 1.154186110789855  -3.764578177916775
     2 "AUT" 2006  1.98301738653537 2.128756864364279 1.189270390899542   3.454041836141215
     2 "AUT" 1996 1.756455604153055 1.913895221077254 .9230566668446084  2.3495338516972737
     2 "AUT" 2003 1.883992308153021 2.044217570260432 1.094921944414693   .9414709207253367
     2 "AUT" 1998 1.793839044983733 1.951728969804905 .9477802672604532   3.581425814604472
     2 "AUT" 2002 1.875038095791109 2.040349252550239 1.093777023145183   1.651553921866693
     2 "AUT" 2017 2.020152257392156 2.167602525226601 1.224984154657427  2.2585724325067105
     2 "AUT" 2014  2.04168861560251 2.187700870445966 1.255483373502949   .6612728488526045
     2 "AUT" 2004 1.900755109729782 2.053165346281867 1.120023207812875   2.735120222410231
     3 "BEL" 2016 2.069590140159018 2.237129931567964 1.311438233093886  1.2666864090209486
     3 "BEL" 2010 2.088541110017618 2.261983346916591 1.423521727153979   2.864292707641553
     3 "BEL" 2006 2.120744679111112 2.270280037527425 1.463949842796464   2.552349943663515
     3 "BEL" 2000 2.080966744672232 2.220354053524708 1.414717025619227  3.7166793842087458
     3 "BEL" 2018 2.079415783285598 2.241166093922424 1.323204197138089  1.8192036640594722
     3 "BEL" 1999 2.061441658349589 2.190037578036447 1.377100161304271   3.542743463630657
     3 "BEL" 2008 2.150909431050873 2.323081651203411 1.496655075176622  .44692873527590393
     3 "BEL" 2002  2.06809792029304 2.205748517120459 1.408652329057564  1.7068845845335403
     3 "BEL" 2005 2.091803542557169 2.238116821785547 1.408082643467065  2.3217370538192625
     3 "BEL" 1998 2.039187916132352 2.168755208711739 1.360854747553523  1.9618082719842675
     3 "BEL" 1995 1.997661786356368 2.147493821637712  1.34440830258337  2.3847572796124865
     3 "BEL" 2015 2.095301629278163 2.287071652899711 1.366530784402922   2.041459009199613
     3 "BEL" 2017 2.085742375157297 2.250595508766169 1.327495652837172  1.6195802783878008
     3 "BEL" 2014 2.090253263285216 2.287698908241935  1.39740147083112  1.5785331432261387
     3 "BEL" 1997 2.028241470539475 2.163636586190112 1.357164502514391  3.7936576295018796
     3 "BEL" 2012 2.115472819697567 2.302996267842922 1.456427397395109   .7392172830586787
     3 "BEL" 2007 2.131394489194554 2.288063260547623 1.479951583539028  3.6768811359497278
     3 "BEL" 2011 2.122265133367199 2.294079974774785 1.474920267833733   1.694513898613323
     3 "BEL" 2013 2.100782977248138 2.290875028082302 1.427964641829653  .45924219290770907
     3 "BEL" 2003  2.05749678604606 2.197632929241373 1.380353617558672  1.0379825490290528
     3 "BEL" 2009 2.069634811087692  2.25077819525326 1.371626975286396  -2.020743061694077
     3 "BEL" 1996 2.003841751983661 2.152328631360727 1.343438754507587  1.3214509304132491
     3 "BEL" 2004 2.072821036218502 2.212928531968061 1.387940765386397   3.571204343358204
     3 "BEL" 2001 2.094070829850742 2.226479659101364 1.425235022157541  1.0996188877784903
    42 "BGR" 2014 2.100531739665294 2.195605592585078 1.440516097361451   .9668690323449596
    42 "BGR" 2003 1.955436454263657 2.033049285849784 1.174887697599893   5.237154277681682
    42 "BGR" 2017 2.073351332394236 2.169541235612566 1.370590045402679   2.762170959612618
    42 "BGR" 2010 2.008306583478645 2.113884974916291 1.317511425762443  1.5418014430757836
    end
    Does someone have an idea how I can export the table to word (mean of U_n for every country including std. dev. and min and max)?

    Kind regards,

    Rolf

  • #2
    asdoc does not support the sum option with tab. This feature is available in asdocx, that has tons of other features, Here is an example of asdocx, using the above data.
    Code:
    asdocx tab country, sum(U_n)  save(country level descriptive stats.docx) replace
     0 |1                           2              3                 4 
    ----+-------------------------------------------------------------------------
      1 |country                  Mean         St.Dev         Frequency 
    ----+-------------------------------------------------------------------------
      2 |ARG                     1.748          0.118                24 
      3 |AUS                     2.082          0.062                24 
      4 |AUT                     1.943          0.107                24 
      5 |BEL                      2.08          0.037                24 
      6 |BGR                     2.034          0.065                 4 
    ------------------------------------------------------------------------------
    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
      Thanks a lot.

      I see you have to pay for this package. Is there no other way to get the tables I want?

      Comment


      • #4
        Attaullah Shah clearly is the authority on asdoc (SSC) and asdocx (pay for it).

        On the question of tabulating mean, SD, min and max, what about summarize or tabstat or table?

        Comment


        • #5
          in addition to Nick Cox comment, see
          Code:
          h putdocx

          Comment


          • #6
            I found a way to do it. Thanks a lot!

            Comment

            Working...
            X