Announcement

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

  • Descriptive table that summarizes all my data

    I have 2 groups in my dataset referring to Credit and LC and would like to know, if its possible to summarize all variable means std Deviation min and max for both Groups and put it in on table?

    Variable | Obs Mean Std. Dev. Min Max
    -------------+---------------------------------------------------------
    Firm | 0
    Legalform | 0
    Age | 40 20.575 22.61142 2 103
    Numberofem~s | 40 14.65 8.813015 3 34
    Industry | 0
    -------------+---------------------------------------------------------
    Grossprofit | 40 1249.05 882.4589 300 3500
    Totalassets | 40 792.55 899.5846 130 3625
    Earnings | 40 95325 57422.92 28000 300000
    Profitabil~y | 40 .095683 .052203 .0228571 .2333333
    Leverage | 40 .41875 .1863439 .2 .9
    -------------+---------------------------------------------------------
    Loantype | 0
    Issuancedate | 40 20866 473.1229 19418 21458
    Time | 40 2016.625 1.254479 2013 2018
    Loansize | 40 67.65 55.09132 8 230
    Loanrate | 40 .0838625 .0060754 .0725 .098
    -------------+---------------------------------------------------------
    Maturity | 40 1.275 .640012 1 3
    Collateral | 0
    Informatio~t | 0
    Bank | 0
    Duration | 40 7.820825 5.82126 0 23.16667
    -------------+---------------------------------------------------------
    Housebank | 40 .5 .5063697 0 1
    V | 0
    Interestra~d | 40 -.004615 .0035236 -.0084 .006
    Loanspread | 40 .0884775 .00635 .078 .1005
    Numberofle~s | 40 1.85 1.02657 1 4
    -------------+---------------------------------------------------------
    GDPGrowth | 40 .018925 .0038921 .005 .022
    Distance | 40 6.4525 4.78834 1 26
    AB | 0
    Collateral~y | 40 .775 .4229021 0 1
    Infodummy | 40 .875 .3349321 0 1
    -------------+---------------------------------------------------------
    Corporatio~y | 40 .625 .4902903 0 1
    g1 | 40 .1 .3038218 0 1
    g2 | 40 .7 .4640955 0 1
    g3 | 40 .2 .4050957 0 1
    GDPGrowth_~t | 40 1.8925 .3892053 .5 2.2
    -------------+---------------------------------------------------------
    Profitabil~t | 40 9.568303 5.220299 2.285714 23.33333
    Leverage_pct | 40 41.875 18.63439 20 90
    Loanspread~t | 40 8.84775 .6349985 7.8 10.05

    . univar if Loantype!="Credit"
    command univar is unrecognized
    r(199);

    . univar if Loantype!="Credit"
    command univar is unrecognized
    r(199);

    . tabulate twoway
    variable twoway not found
    r(111);

    . tabstat twoway
    variable twoway not found
    r(111);

    . tabstat
    varlist required
    r(100);

    . tabstat Loanspread_pct Age Totalassets Numberofemployees Corporationdummy Grossprofit Profitability_pct Leverage_pct Loansize Maturity g1 g3 GDPGrowth_pct Duration Housebank
    > if Loantype!="LC"

    stats | Loansp~t Age Totala~s Numbe~es Corpor~y Grossp~t Profit~t Levera~t Loansize Maturity g1 g3 GDPGro~t Duration Houseb~k
    ---------+------------------------------------------------------------------------------------------------------------------------------------------------------
    mean | 3.154878 22 1121.024 18.14634 .7317073 1467.293 9.113236 43.90244 201.9512 7.341463 .2195122 .2926829 1.678049 9.552764 .5853659
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------

    . dataex Loanspread_pct Age Totalassets Numberofemployees Corporationdummy Grossprofit Profitability_pct Leverage_pct Loansize Maturity g1 g3 GDPGrowth_pct Duration Housebank L
    > oantype

    ----------------------- copy starting from the next line -----------------------
    [CODE]
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float Loanspread_pct int Age long Totalassets byte Numberofemployees float Corporationdummy long Grossprofit float(Profitability_pct Leverage_pct) long Loansize byte(Maturity g1 g3) float GDPGrowth_pct double Duration byte Housebank str6 Loantype
    5.45 8 1500 28 1 1600 6.25 95 475 10 0 1 1.5 0 0 "Credit"
    1.25 8 1500 28 1 1600 6.25 95 475 10 0 1 1.5 0 0 "Credit"
    2.52 6 500 15 1 800 8.75 50 150 10 0 1 1.5 5.75 1 "Credit"
    9.14 6 500 15 1 800 8.75 50 30 1 0 1 1.5 5.75 1 "LC"
    9.07 6 500 15 1 800 8.75 50 20 1 0 1 1.5 6 1 "LC"
    8.72 23 387 10 0 815 3.435583 72 80 1 0 0 2.2 10 1 "LC"
    8.67 24 415 10 0 830 5.060241 77 80 1 0 0 2.2 11 1 "LC"
    8.55 25 400 10 0 850 3.529412 90 120 1 0 0 1.5 12 1 "LC"
    5.02 24 415 10 0 830 5.060241 77 60 6 0 0 2.2 1 0 "Credit"
    9.42 15 800 25 1 3500 3.4285715 20 100 1 0 1 1.5 4.666666666666667 0 "LC"
    4.07 15 800 25 1 3500 3.4285715 20 620 20 0 1 1.5 0 0 "Credit"
    9.31 15 800 25 1 3500 3.4285715 20 230 3 0 1 1.5 5 0 "LC"
    1.76 7 130 8 0 300 23.333334 40 50 10 1 0 1.5 4.75 1 "Credit"
    .71 1 60 3 0 190 0 0 20 10 1 0 .5 0 1 "Credit"
    9.16 7 130 8 0 300 23.333334 40 15 3 1 0 2.2 3 0 "LC"
    3.26 20 450 12 1 800 8.125 26 50 10 0 0 1.5 10.083333333333334 0 "Credit"
    4.33 18 462 12 1 830 8.192771 32 125 5 0 0 2.2 8 0 "Credit"
    5.17 19 438 12 1 755 7.549669 30 100 5 0 0 2.2 0 0 "Credit"
    8.15 20 450 12 1 800 8.125 26 15 1 0 0 1.5 10 0 "LC"
    8.26 19 438 12 1 755 7.549669 30 15 1 0 0 2.2 9 0 "LC"
    8 18 462 12 1 830 8.192771 32 15 1 0 0 2.2 8 0 "LC"
    8.84 19 438 12 1 755 7.549669 30 120 1 0 0 2.2 10 0 "LC"
    8.97 18 462 12 1 830 8.192771 32 120 1 0 0 2.2 9 0 "LC"
    8.67 20 450 12 1 800 8.125 26 10 1 0 0 1.5 10.583333333333334 0 "LC"
    3.9 15 320 10 1 1000 8 55 70 6 1 0 1.5 7 0 "Credit"
    4.09 15 320 10 1 1000 8 55 100 5 1 0 1.5 5.166666666666667 0 "Credit"
    3.33 10 277 12 1 800 9.375 60 150 4 1 0 1.5 5.083333333333333 1 "Credit"
    2.79 18 720 25 1 1800 11.38889 45 350 3 1 0 2.2 12 1 "Credit"
    2.45 20 695 25 1 2000 10.5 45 300 6 1 0 1.5 14 1 "Credit"
    4.55 3 248 3 1 500 11 44 30 4 0 0 1.7 0 0 "Credit"
    4.91 4 250 3 1 600 8.333333 50 50 5 0 0 2.2 1.33 0 "Credit"
    10.05 3 248 3 1 500 11 44 8 1 0 0 1.7 0 0 "LC"
    10.02 4 250 3 1 600 8.333333 50 8 1 0 0 2.2 1 0 "LC"
    10.03 4 250 3 1 600 8.333333 50 10 3 0 0 2.2 1.083 0 "LC"
    9.84 2 462 25 1 1750 2.2857144 45 100 1 0 0 2.2 0 0 "LC"
    9.43 3 450 29 1 1900 2.710526 50 200 3 0 0 2.2 .5833333333333334 0 "LC"
    9.62 3 450 29 1 1900 2.710526 50 100 1 0 0 2.2 1 0 "LC"
    5.26 2 462 25 1 1750 2.2857144 45 250 5 0 0 2.2 0 0 "Credit"
    5.12 4 440 29 1 2000 2.5 50 200 5 0 0 1.5 1.4166666666666667 0 "Credit"
    8.16 7 360 9 1 415 18.795181 25 15 1 0 0 1.7 5 1 "LC"
    8.11 8 350 9 1 435 18.62069 25 25 1 0 0 2.2 6 1 "LC"
    8.04 9 345 9 1 430 18.60465 30 15 1 0 0 2.2 7 1 "LC"
    2.58 45 1000 14 0 1450 7.931035 60 350 7 1 0 .5 15 1 "Credit"
    2.27 50 1050 15 0 1500 6.666667 70 300 10 1 0 1.5 20 1 "Credit"
    8.23 45 1000 14 0 1450 7.931035 60 150 1 1 0 .5 15 1 "LC"
    8.07 46 970 15 0 1400 6.785714 70 150 1 1 0 2.2 16.5 1 "LC"
    8.05 47 960 15 0 1475 6.779661 70 150 1 1 0 1.7 17.75 1 "LC"
    8.78 7 350 3 0 400 12.5 50 20 1 0 0 1.5 7 1 "LC"
    3.39 7 350 3 0 400 12.5 50 15 5 0 0 1.5 7 1 "Credit"
    2.9 25 500 25 1 1100 18.181818 80 150 10 0 0 1.5 15 1 "Credit"
    2.6 25 500 25 1 1100 18.181818 80 400 15 0 0 1.5 15 1 "Credit"
    8.52 25 500 25 1 1100 18.181818 80 50 1 0 0 1.5 15 1 "LC"
    2.1 40 620 25 0 2000 15 20 150 10 0 0 1.5 20 1 "Credit"
    8.12 40 620 25 0 2000 15 20 50 1 0 0 1.5 20 1 "LC"
    2.57 35 380 12 1 1500 6.666667 30 25 5 0 0 1.5 15 1 "Credit"
    3.12 4 400 7 0 950 13.68421 25 300 5 0 0 1.7 3 1 "Credit"
    2.54 7 425 9 0 1000 12.3 20 250 7 0 0 1.5 6 1 "Credit"
    8.76 4 400 7 0 950 13.68421 25 50 1 0 0 1.7 3 1 "LC"
    8.82 5 415 8 0 975 14.358974 20 80 1 0 0 2.2 4.333333333333333 1 "LC"
    8.87 6 410 9 0 935 13.368984 20 80 1 0 0 2.2 5.333333333333333 1 "LC"
    8.66 7 425 9 0 1000 12.3 20 80 1 0 0 1.5 6 1 "LC"
    2.85 102 370 6 0 427 14.285714 42 80 5 0 0 2.2 23 1 "Credit"
    9.24 102 370 6 0 427 14.285714 42 30 1 0 0 2.2 8 0 "LC"
    9.17 103 375 6 0 430 13.953488 45 45 1 0 0 2.2 8.75 0 "LC"
    1.6 102 370 6 0 427 14.285714 42 80 5 0 0 2.2 0 0 "Credit"
    1.91 17 3500 28 1 2875 5.495652 38 500 10 0 1 .5 14 1 "Credit"
    3.76 22 3625 30 1 3000 5 40 400 7 0 1 2.2 4 0 "Credit"
    9.36 22 3625 30 1 3000 5 40 60 2 0 1 2.2 5 0 "LC"
    9.68 22 3625 30 1 3000 5 40 50 2 0 1 2.2 .16666666666666666 0 "LC"
    4.61 18 3100 15 1 2600 6.538462 50 150 3 0 1 1.8 5 0 "Credit"
    4.65 18 3100 15 1 2600 6.538462 50 130 4 0 1 1.8 4 0 "Credit"
    9.4 18 3100 15 1 2600 6.538462 50 50 2 0 1 1.8 4 0 "LC"
    2.09 26 2650 35 1 2300 9 21 300 5 0 1 2.2 22 1 "Credit"
    2.15 27 2710 35 1 2425 9.278351 28 250 7 0 1 1.7 23 1 "Credit"
    1.98 29 2665 33 1 2400 8.75 25 50 9 0 1 2.2 25.25 1 "Credit"
    1.75 30 2700 33 1 2350 8.297873 25 80 10 0 1 1.5 26.333333333333332 1 "Credit"
    7.8 27 2710 34 1 2425 9.278351 28 80 1 0 1 1.7 23.166666666666668 1 "LC"
    2.74 17 1980 26 1 1650 8.939394 26 325 10 0 0 2.2 16 1 "Credit"
    2.7 19 2050 26 1 1700 8.941176 31 150 8 0 0 2.2 18.333333333333332 1 "Credit"
    2.55 20 1930 26 1 1750 8.857142 33 220 5 0 0 1.5 19.166666666666668 1 "Credit"
    8.15 19 2050 26 1 1700 8.941176 31 80 1 0 0 2.2 18.166666666666668 1 "LC"


  • #2
    If you use MS Word, Attaullah Shah's command asdoc from SSC has this feature.

    Code:
    ssc install asdoc
    ds, has(type numeric)
    asdoc sum `r(varlist)', by(Loantype) save(sumtable)

    Comment


    • #3

      Thx Andrew. Can the variables be put in the first column and change the positions with the loantypes so that only one table gets displayed?
      . . asdoc sum `r(Age Totalassets Numberofemployees Corporationdummy Grossprofit Profitability_pct Leverage_pct g1 g2 g3 GDPGrowth_pct Loanspread_pct Collateraldummy InfodummyLo
      > ansize Maturity Duration Housebank)', by(Loantype) save(sumtable)
      (File sumtable.doc already exists, option append was assumed)

      Summary statistics: N, mean, sd, min, max
      by categories of: __000000 (Loan type)

      __000000 | Age Numbe~es Grossp~t Totala~s Earnings Profit~y Leverage Issuan~e Time Loansize Loanrate Maturity Duration Houseb~k Intere~d Loansp~d
      ---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------
      Credit | 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41
      | 22 18.14634 1467.293 1121.024 119914.6 .0911324 .4390244 20893.8 2016.78 201.9512 .0329024 7.341463 9.552764 .5853659 .0013537 .0315488
      | 21.62984 10.05127 827.1785 1067.303 66637.26 .0450479 .2098429 674.8836 1.710441 153.8988 .0105553 3.373498 8.374994 .498779 .0056543 .0123287
      | 1 3 190 60 0 0 0 18993 2012 15 .016 3 0 0 -.0056 .0071
      | 102 35 3500 3625 300000 .2333333 .95 21458 2018 620 .058 20 26.33333 1 .0199 .0545
      ---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------
      LC | 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40
      | 20.575 14.65 1249.05 792.55 95325 .095683 .41875 20866 2016.625 67.65 .0838625 1.275 7.820825 .5 -.004615 .0884775
      | 22.61142 8.813015 882.4589 899.5846 57422.92 .052203 .1863439 473.1229 1.254479 55.09132 .0060754 .640012 5.82126 .5063697 .0035236 .00635
      | 2 3 300 130 28000 .0228571 .2 19418 2013 8 .0725 1 0 0 -.0084 .078
      | 103 34 3500 3625 300000 .2333333 .9 21458 2018 230 .098 3 23.16667 1 .006 .1005
      ---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------
      Total | 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81
      | 21.2963 16.41975 1359.519 958.8148 107771.6 .0933796 .4290123 20880.07 2016.704 135.6296 .0580679 4.345679 8.697486 .5432099 -.0015938 .0596617
      | 21.99287 9.564079 856.6209 995.6836 63093.34 .0484604 .1976082 580.5636 1.495363 133.7419 .0270361 3.899232 7.235286 .501233 .0055726 .0302635
      | 1 3 190 60 0 0 0 18993 2012 8 .016 1 0 0 -.0084 .0071
      | 103 35 3500 3625 300000 .2333333 .95 21458 2018 620 .098 20 26.33333 1 .0199 .1005
      --------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      __000000 | Numbe~rs GDPGro~h Distance Collat~y Infodu~y Corpor~y g1 g2 g3 GDPGro~t Profit~t Levera~t Loansp~t Banks _est_fe _est_re
      ---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------
      Credit | 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41
      | 1.707317 .0167805 8.017073 .5121951 .5853659 .7317073 .2195122 .4878049 .2926829 1.678049 9.113236 43.90244 3.154878 5.243902 1 1
      | 1.006079 .0045745 9.093594 .5060608 .498779 .448575 .4190582 .5060608 .4606464 .4574452 4.504789 20.98429 1.232875 1.959343 0 0
      | 1 .005 1 0 0 0 0 0 0 .5 0 0 .71 1 1 1
      | 4 .022 50 1 1 1 1 1 1 2.2 23.33333 95 5.45 8 1 1
      ---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------
      LC | 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40
      | 1.85 .018925 6.4525 .775 .875 .625 .1 .7 .2 1.8925 9.568303 41.875 8.84775 6.6 0 0
      | 1.02657 .0038921 4.78834 .4229021 .3349321 .4902903 .3038218 .4640955 .4050957 .3892053 5.220299 18.63439 .6349985 1.62985 0 0
      | 1 .005 1 0 0 0 0 0 0 .5 2.285714 20 7.8 3 0 0
      | 4 .022 26 1 1 1 1 1 1 2.2 23.33333 90 10.05 9 0 0
      ---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------
      Total | 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81
      | 1.777778 .0178395 7.244444 .6419753 .7283951 .6790123 .1604938 .5925926 .2469136 1.783951 9.337961 42.90123 5.966173 5.91358 .5061728 .5061728
      | 1.012423 .0043602 7.289976 .4824065 .4475585 .4697648 .3693504 .4944132 .4339028 .4360209 4.846038 19.76082 3.026349 1.918317 .503077 .503077
      | 1 .005 1 0 0 0 0 0 0 .5 0 0 .71 1 0 0
      | 4 .022 50 1 1 1 1 1 1 2.2 23.33333 95 10.05 9 1 1
      --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      Click to Open File: sumtable.doc

      Comment


      • #4
        I do not think so, you may have to create the table yourself.

        Comment


        • #5
          Can you tell me, why there are different means for the same variables in the 2 tables?

          Comment


          • #6
            Didn't you ask for a summary by loan type?

            I have 2 groups in my dataset referring to Credit and LC and would like to know, if its possible to summarize all variable means std Deviation min and max for both Groups and put it in on table?
            One set relates to "loan type=LC" and the other "loan type= Credit" because loan type has these two categories. If you need a summary of the full sample

            Code:
            ssc install asdoc
            ds, has(type numeric)
            asdoc sum `r(varlist)', save(sumtable) replace
            Last edited by Andrew Musau; 15 Mar 2019, 09:58.

            Comment


            • #7
              This recent thread using outreg2 (SSC) seems relevant to what you are looking for. It produces one table.

              https://www.statalist.org/forums/for...ves-to-outreg2

              Comment


              • #8
                Andrew: I coded:
                Code:
                 outreg2 using "Kopie_von_Issa_Exceltabelle_neu",  sum(log) eqkeep(mean sd N)sortvar(Loantype)
                but Stata returns only the summarise of the whole sample but does not differentiate between my two loangroups. As in the manual fr outreg2 I could not find any option to differ groups or am I wrong?

                Comment


                • #9
                  Code:
                  bys Loantype: outreg2 using "Kopie_von_Issa_Exceltabelle_neu", sum(log) eqkeep(mean sd N) replace

                  Comment


                  • #10
                    Thx a lot Andrew! That was exactly what I was looking for!

                    Comment

                    Working...
                    X