Announcement

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

  • Adjusting length of column headers in matlist

    Hi All,

    I am having trouble adjusting the length of column headers to show the entire text, when presenting a matrix using matlist. Any help is appreciated!

    Ariel

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(ALL1 ALL2 ALL3 ALL4 ALL5 ALL6)
      -.1982456 .04262157  -4.651298 3.298521e-06 -.28178236 -.11470888
     -.02752678 .04406928  -.6246251     .5322171 -.11390098  .05884742
    -.023157895 .04252423  -.5445812     .5860416 -.10650386  .06018807
    -.063825496 .04219687 -1.5125648    .13039024 -.14652982 .018878844
      .02011696 .04021326  .50025684     .6168942 -.05869959   .0989335
    end
    Code:
    mkmat ALL*, matrix(ALL)
    mat colname ALL = "exp(b)" "std. err." "z" "P>|z|" "[95% conf." "interval]"
    Code:
    matlist ALL, cspec(& %12s | %9.0g & b %9.0g & %5.2f & %7.3f & w10 L %9.0g & R %9.0g &) rspec(--&&&&-)



  • #2
    You can name the column equations the same as the column names. Then, a combination of -coleqonly- and -showcoleq(combined)- should get you what you want. From

    Code:
    help matlist
    If necessary, equation names are truncated to the width of the field in which the names are displayed. With combined, lcombined, and rcombined, the field comprises all columns and the associated separators for the equation.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(ALL1 ALL2 ALL3 ALL4 ALL5 ALL6)
      -.1982456 .04262157  -4.651298 3.298521e-06 -.28178236 -.11470888
     -.02752678 .04406928  -.6246251     .5322171 -.11390098  .05884742
    -.023157895 .04252423  -.5445812     .5860416 -.10650386  .06018807
    -.063825496 .04219687 -1.5125648    .13039024 -.14652982 .018878844
      .02011696 .04021326  .50025684     .6168942 -.05869959   .0989335
    end
    
    mkmat ALL*, matrix(ALL)
    mat colname ALL = "exp(b)" "std. err." "z" "P>|z|" "[95% conf." "interval]"
    mat coleq ALL = "exp(b)" "std. err." "z" "P>|z|" "[95% conf." "interval]"
    matlist ALL, cspec(& %12s | %9.0g & b %9.0g & %5.2f & %7.3f & w10 L %9.0g & R %9.0g &) rspec(--&&&&-) coleqonly showcoleq(combined)
    Res.:

    Code:
    . matlist ALL, cspec(& %12s | %9.0g & b %9.0g & %5.2f & %7.3f & w10 L %9.0g & R %9.0g &) rspec(--&&&&-) coleqonly showcoleq(combined)
    
    --------------------------------------------------------------------------
                 |   exp(b)   std. err.    z     P>|z|   [95% conf.  interval]
    -------------+------------------------------------------------------------
              r1 | -.1982456   .0426216  -4.65    0.000  -.2817824   -.1147089
              r2 | -.0275268   .0440693  -0.62    0.532   -.113901    .0588474
              r3 | -.0231579   .0425242  -0.54    0.586  -.1065039    .0601881
              r4 | -.0638255   .0421969  -1.51    0.130  -.1465298    .0188788
              r5 |   .020117   .0402133   0.50    0.617  -.0586996    .0989335
    --------------------------------------------------------------------------

    Comment


    • #3
      Thank you, Andrew (again)! This is great!

      Ariel

      Comment

      Working...
      X