Announcement

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

  • How to use summarize command for each selected year?

    dear all stats,

    I am trying to use summarize command for each year so I can get information like the attached pic.
    I have panel data, and I need to have mean Std.dev min max for variables: size, leverage, profitability, tangibility, and growth from 2016-2021
    Click image for larger version

Name:	1.PNG
Views:	1
Size:	27.0 KB
ID:	1664012


    Any help will be much appreciated.

  • #2
    Code:
    table (var) year, style(table-1) stat(mean leverage size growth profitability tangibility) stat(sd leverage size growth profitability tangibility)

    Comment


    • #3
      If you do not have Stata 17, then try asdoc or asdocx
      Code:
      ssc install asdoc
      webuse grunfeld
      keep if year >1940
      asdocx tabstat invest mvalue kstock, by(year) stat(mean sd)
      
        0 |1                                        2                     3 
      ----+-----------------------------------------------------------------------------
        1 |                                      Mean                    SD 
      ----+-----------------------------------------------------------------------------
        2 | Year =  1941                                                    
        3 |invest                             139.719               188.221 
        4 |mvalue                            1087.948              1445.961 
        5 |kstock                             176.832               121.946 
        6 |  Year =  1942                                                   
        7 |invest                             122.665               172.223 
        8 |mvalue                             880.846              1087.446 
        9 |kstock                             203.823               136.542 
       10 |  Year =  1943                                                   
       11 |invest                              117.79               168.941 
       12 |mvalue                             995.164              1269.276 
       13 |kstock                             213.618               139.298 
       14 |  Year =  1944                                                   
       15 |invest                             120.925               169.151 
       16 |mvalue                            1027.772              1330.608 
       17 |kstock                             211.991               147.049 
       18 |  Year =  1945                                                   
       19 |invest                             124.159                168.69 
       20 |mvalue                            1140.105              1470.883 
       21 |kstock                             219.241               156.187 
       22 |  Year =  1946                                                   
       23 |invest                             161.359               219.943 
       24 |mvalue                            1203.964              1506.231 
       25 |kstock                             233.683               175.373 
       26 |  Year =  1947                                                   
       27 |invest                             147.135               189.748 
       28 |mvalue                             927.297              1096.211 
       29 |kstock                              307.91               239.411 
       30 |  Year =  1948                                                   
       31 |invest                             153.948               192.253 
       32 |mvalue                              896.98              1000.735 
       33 |kstock                             348.998               279.415 
       34 |  Year =  1949                                                   
       35 |invest                             139.244               185.025 
       36 |mvalue                             917.554               1114.52 
       37 |kstock                             384.349               304.426 
       38 |  Year =  1950                                                   
       39 |invest                             151.061               209.028 
       40 |mvalue                             977.055              1128.501 
       41 |kstock                             404.504               325.854 
       42 |  Year =  1951                                                   
       43 |invest                             199.583               255.822 
       44 |mvalue                            1208.084              1461.103 
       45 |kstock                             426.607                352.71 
       46 |  Year =  1952                                                   
       47 |invest                             224.033               295.669 
       48 |mvalue                            1254.382              1478.284 
       49 |kstock                             485.703                405.35 
       50 |  Year =  1953                                                   
       51 |invest                             275.583               402.546 
       52 |mvalue                            1477.781              1837.023 
       53 |kstock                             564.878               497.178 
       54 |  Year =  1954                                                   
       55 |invest                             273.781               444.423 
       56 |mvalue                            1437.942              1695.459 
       57 |kstock                             645.053               618.002 
      ----------------------------------------------------------------------------------
      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


      • #4
        Originally posted by Øyvind Snilsberg View Post
        Code:
        table (var) year, style(table-1) stat(mean leverage size growth profitability tangibility) stat(sd leverage size growth profitability tangibility)
        Thanks a lot!!

        Comment

        Working...
        X