Announcement

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

  • descriptive statistics and correlation of panel data from STATA to excel

    Hi,

    I am trying to export a descriptive statistics of panel data from STATA to excel by using the following code,

    Code:
    univar Y X1 X2 X3
    I got the result like below
    Code:
                                            -------------- Quantiles --------------
    Variable       n     Mean     S.D.      Min      .25      Mdn      .75      Max
    -------------------------------------------------------------------------------
      LN_PAT   79447     1.12     1.43     0.00     0.00     0.69     1.79     9.06
     LN_CITE   79447     0.70     1.26     0.00     0.00     0.00     1.10     8.97
    LN_GENERAL   79447     0.34     0.78     0.00     0.00     0.00     0.41     7.02
    LN_ORIGINAL   79447     0.33     0.77     0.00     0.00     0.00     0.40     6.83
      IE_PAT   50553     2.29    12.49     0.00     0.00     0.18     0.82   792.34
     IE_CITE   50553     1.37     8.87     0.00     0.00     0.00     0.37   513.86
    Liquidity   76721     7.60     3.14   -21.25     5.26     7.66     9.94    20.58
      Spread   38900     0.02     0.08    -0.48     0.00     0.01     0.02     1.92
    LN_Total_Assets   70930    12.79     2.19    -2.00    11.38    12.68    14.14    22.09
       PPETA   69088     0.76    48.64     0.00     0.28     0.50     0.79 12778.00
         LEV   70904     2.31   526.79     0.00     0.04     0.18     0.33  1.4e+05
     CAPEXTA   66332     0.05     0.05    -0.28     0.02     0.04     0.07     1.93
        RDTA   52485     0.09     0.49    -0.00     0.01     0.03     0.08    79.05
           Q   70018    35.43  8150.82 -1215.39     1.04     1.38     2.17  2.2e+06
      LN_AGE   79447     2.40     0.80     0.69     1.79     2.48     3.04     3.87
    Short_Liq   70233     2.90    12.61     0.00     1.25     1.80     2.94  2984.44
        Cash   50299     0.12     0.14    -0.44     0.03     0.08     0.16     1.00
         ROA   68467   -12.62  2379.64 -5.3e+05     0.00     0.04     0.08   189.06
       LN_MV   78545     5.46     2.28   -28.64     4.04     5.38     6.89    13.19
    Sale_growth   67772     0.79    58.48   -20.70    -0.03     0.06     0.20 11879.50
    -------------------------------------------------------------------------------
    However, when I am trying to export it to excel with fix format. the result looks like below
    Code:
     set matsize 10000
    
    . outreg2 using statistics_firm, replace
    matrix e(b) not found; run/post a regression, or specify varlist for non-regression outputs
    r(111);
    
    end of do-file
    
    r(111);
    Do you know why? What should I do? Could you please give me some suggestions about this?
    Besides,
    1) I am a fresher of STATA, if you have some webpage to introduce a complete process to create descriptive statistics and correlation of a panel data, could you please share it to me?
    2) when creating statistics and correlation of panel data, will there be any difference between it and other kinds of data? or Is there anything I need to pay special attention to?

    I am trying to create tables like below,
    (Thanks in advance)
    Click image for larger version

Name:	1.png
Views:	1
Size:	101.7 KB
ID:	1580888

    Click image for larger version

Name:	2.png
Views:	1
Size:	120.2 KB
ID:	1580889

  • #2
    You can use asdoc to export descriptive statistics to MS Word and asdocx (the premium version of asdoc) to export Excel. Here is an example
    Code:
    ssc install asdoc
    asdoc sum, stat(N mean sd p5 median p95)
    asdoc pwcorr, star(all)
    You can know more about descriptive statistics using asdoc here in this YouTube Video.
    Or Table of Contents of asdoc https://fintechprofessor.com/2018/01/31/asdoc/
    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	55.0 KB
ID:	1580897
    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
      You can use asdoc to export descriptive statistics to MS Word and asdocx (the premium version of asdoc) to export Excel. Here is an example
      Code:
      ssc install asdoc
      asdoc sum, stat(N mean sd p5 median p95)
      asdoc pwcorr, star(all)
      You can know more about descriptive statistics using asdoc here in this YouTube Video.
      Or Table of Contents of asdoc https://fintechprofessor.com/2018/01/31/asdoc/
      [ATTACH=CONFIG]n1580897[/ATTACH]

      Hi Prof. Shah,

      Many thanks for your help.
      following your link, I am using the code
      Code:
      asdoc sum  Y X1 X2 X3 X4, stat(N mean sd p5 median p95) dec(3) replace
      however, the
      Code:
      dec(3)
      does not work,
      Code:
                   |         N       mean         sd         p5        p50        p95 
      -------------+------------------------------------------------------------------
            LN_PAT |     79447   1.115698    1.42998          0   .6931472   4.158883 
           LN_CITE |     79447   .7004643   1.257319          0          0   3.465736 
        LN_GENERAL |     79447   .3447748   .7820351          0          0   2.016753 
       LN_ORIGINAL |     79447   .3321707   .7654745          0          0   1.965684 
            IE_PAT |     50553   2.292718   12.48637          0    .182088   8.490066 
           IE_CITE |     50553   1.374679   8.867212          0          0   4.418584 
         Liquidity |     76721   7.595299   3.143591   2.415653   7.659879   12.59588 
            Spread |     38900   .0243305     .07648   .0009885   .0069355   .0869603 
      LN_Total_A~s |     70930   12.78842   2.185075   9.392663   12.68457   16.57771 
             PPETA |     69088     .76283   48.64224    .081798    .500254   1.271218 
               LEV |     70904   2.310439   526.7873          0   .1832635    .565869 
           CAPEXTA |     66332   .0536419   .0534276     .00414    .039875    .148583 
              RDTA |     52485   .0898155    .491815    .000383    .031245    .306778 
                 Q |     70018   35.43024   8150.817    .732729   1.381763   5.814124 
            LN_AGE |     79447   2.396289   .7969534   .6931472   2.484907   3.526361 
         Short_Liq |     70233   2.901506   12.60819    .763822   1.803492   7.857182 
              Cash |     50299   .1230296   .1388202    .004708    .079611     .39368 
               ROA |     68467  -12.62364   2379.637     -.4711      .0363      .1698 
             LN_MV |     78545   5.461543   2.281338   2.011347   5.379716   9.273581 
       Sale_growth |     67772   .7921609   58.47863       -.29        .06         .8
      Could you please give me more suggestions?

      Comment


      • #4
        Besides,

        I sam some video introduce to use
        HTML Code:
        gen miss1=missing(Y X1 X2)
        tabstat Y X1 X2 if miss1==0, stats(n means) c(s) f(%10,3f)
        to process the missing value and then do descriptive statistics

        Should I do it as well before using 'asdoc'?

        Comment

        Working...
        X