Announcement

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

  • long variable names in estimation output

    Is there a display option that allows me to get the estimation output (e.g., reg, logit, or even summarize) to provide full variable names for long variables (more than 12 characters)?

  • #2
    If you make your results window wider, that will increase the linesize setting and if wide enough your long variable names won't be shortened - at least in the regress command.
    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . rename displacement abcdefghijklmnopqrstuvwxyz
    
    . regress price abcdefghijklmnopqrstuvwxyz
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(1, 72)        =     23.36
           Model |   155571304         1   155571304   Prob > F        =    0.0000
        Residual |   479494092        72  6659640.17   R-squared       =    0.2450
    -------------+----------------------------------   Adj R-squared   =    0.2345
           Total |   635065396        73  8699525.97   Root MSE        =    2580.6
    
    -------------------------------------------------------------------------------
            price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    --------------+----------------------------------------------------------------
    abcdefghijk~z |   15.89588   3.288859     4.83   0.000      9.33966     22.4521
            _cons |   3029.042   714.8736     4.24   0.000     1603.968    4454.117
    -------------------------------------------------------------------------------
    
    . display c(linesize)
    80
    
    . * made my window wider
    
    . display c(linesize)
    96
    
    . regress price abcdefghijklmnopqrstuvwxyz
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(1, 72)        =     23.36
           Model |   155571304         1   155571304   Prob > F        =    0.0000
        Residual |   479494092        72  6659640.17   R-squared       =    0.2450
    -------------+----------------------------------   Adj R-squared   =    0.2345
           Total |   635065396        73  8699525.97   Root MSE        =    2580.6
    
    --------------------------------------------------------------------------------------------
                         price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    ---------------------------+----------------------------------------------------------------
    abcdefghijklmnopqrstuvwxyz |   15.89588   3.288859     4.83   0.000      9.33966     22.4521
                         _cons |   3029.042   714.8736     4.24   0.000     1603.968    4454.117
    --------------------------------------------------------------------------------------------
    
    .

    Comment


    • #3
      Thanks, it works with estimation commands but not with summary.

      Comment


      • #4
        I confirm that it does not work with the summarize command in Stata 16.0 from 24 July 2019.

        The output of help summarize suggests that while it supports many of the estimation display options, it does not support lsquish, which is what controls the solution used by estimation commands. Here is the start of a do-it-yourself approach to achieving output similar to summarize using the collapse command.
        Code:
        cls
        sysuse auto, clear
        rename displacement abcdefghijklmnopqrstuvwxyz
        summarize price abcdefghijklmnopqrstuvwxyz
        rename (price abcdefghijklmnopqrstuvwxyz) (v_=)
        generate id = _n
        reshape long v_, i(id) j(var) string
        collapse (count) N=v_ ///
                 (mean) Mean=v_ ///
                 (sd) StdDev=v_ ///
                 , by(var)
        list, noobs
        Code:
        . summarize price abcdefghijklmnopqrstuvwxyz
        
            Variable |        Obs        Mean    Std. Dev.       Min        Max
        -------------+---------------------------------------------------------
               price |         74    6165.257    2949.496       3291      15906
        abcdefghij~z |         74    197.2973    91.83722         79        425
        Code:
        . list, noobs
        
          +-----------------------------------------------------+
          |                        var    N      Mean    StdDev |
          |-----------------------------------------------------|
          | abcdefghijklmnopqrstuvwxyz   74   197.297   91.8372 |
          |                      price   74   6,165.3   2,949.5 |
          +-----------------------------------------------------+

        Comment


        • #5
          Stata 16 has an issue with the mean, over(x) command when the factor variable has negative values. This is not an issue in Stata 15. here is an example
          mean rel_percapgdp, over(war_year). Any suggestions?
          Zeev


          The error message I get is this:
          invalid over() option;
          war_year: factor variables may not contain negative values
          r(452);

          With stata 15 and the same command I get:

          Mean estimation Number of obs = 4,608

          _subpop_1: war_year = -20
          _subpop_2: war_year = -19
          _subpop_3: war_year = -18
          _subpop_4: war_year = -17
          _subpop_5: war_year = -16
          _subpop_6: war_year = -15
          _subpop_7: war_year = -14
          _subpop_8: war_year = -13
          _subpop_9: war_year = -12
          _subpop_10: war_year = -11
          _subpop_11: war_year = -10
          _subpop_12: war_year = -9
          _subpop_13: war_year = -8
          _subpop_14: war_year = -7
          _subpop_15: war_year = -6
          _subpop_16: war_year = -5
          _subpop_17: war_year = -4
          _subpop_18: war_year = -3
          _subpop_19: war_year = -2
          _subpop_20: war_year = -1
          0: war_year = 0
          1: war_year = 1
          2: war_year = 2
          3: war_year = 3
          4: war_year = 4
          5: war_year = 5
          6: war_year = 6
          7: war_year = 7
          8: war_year = 8
          9: war_year = 9
          10: war_year = 10
          11: war_year = 11
          12: war_year = 12
          13: war_year = 13
          14: war_year = 14
          15: war_year = 15
          16: war_year = 16
          17: war_year = 17
          18: war_year = 18
          19: war_year = 19
          20: war_year = 20


          Over Mean Std. Err. [95% Conf. Interval]

          rel_percapgdp
          _subpop_1 .7974137 .0280355 .7424508 .8523766
          _subpop_2 .8231348 .0282492 .7677528 .8785168
          _subpop_3 .8222696 .0332884 .7570084 .8875308
          _subpop_4 .8341215 .0312841 .7727898 .8954532
          _subpop_5 .8490373 .028684 .792803 .9052716
          _subpop_6 .8735436 .0268457 .8209131 .926174
          _subpop_7 .8667623 .0244916 .818747 .9147777
          _subpop_8 .8796041 .0244383 .8316934 .9275149
          _subpop_9 .8942777 .0255172 .8442519 .9443036
          _subpop_10 .9091615 .0250422 .8600669 .9582562
          _subpop_11 .9032334 .0211753 .8617197 .9447471
          _subpop_12 .9228034 .025218 .8733641 .9722427
          _subpop_13 .9201524 .0220391 .8769452 .9633597
          _subpop_14 .9318283 .0201411 .892342 .9713145
          _subpop_15 .9272858 .0190886 .889863 .9647086
          _subpop_16 .9216099 .0178899 .8865371 .9566828
          _subpop_17 .9407769 .0158415 .9097201 .9718338
          _subpop_18 .9743824 .0084496 .9578171 .9909477
          _subpop_19 1.004311 .0094961 .9856946 1.022928
          _subpop_20 1 0 . .
          0 1.015073 .0087466 .9979252 1.03222
          1 1.03485 .0136915 1.008008 1.061692
          2 1.041016 .015524 1.010581 1.07145
          3 1.065815 .0189255 1.028712 1.102918
          4 1.09796 .0224155 1.054015 1.141905
          5 1.118874 .0253709 1.069135 1.168613
          6 1.145478 .0258577 1.094784 1.196171
          7 1.189122 .0288592 1.132544 1.2457
          8 1.230058 .0329496 1.16546 1.294655
          9 1.260731 .0360337 1.190088 1.331374
          10 1.298719 .041549 1.217263 1.380175
          11 1.316945 .0446624 1.229385 1.404505
          12 1.348961 .0510046 1.248968 1.448954
          13 1.380862 .0583403 1.266487 1.495237
          14 1.442283 .0679952 1.30898 1.575586
          15 1.492389 .0730039 1.349267 1.635512
          16 1.555568 .0806995 1.397358 1.713778
          17 1.577321 .0870413 1.406678 1.747963
          18 1.623449 .0982935 1.430746 1.816151
          19 1.692235 .1081686 1.480173 1.904298
          20 1.723119 .1167607 1.494212 1.952026


          Comment

          Working...
          X