Announcement

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

  • Deleting a row header from a customized table

    I am creating a Table 1 using the "collect" command in Stata. I would like to have a "Total" row at the top; however, when I do this, I get both a dimension label and a level label (see image). I have tried multiple ways to delete the header "Total," but seem unable to get it to disappear. I can delete the level label "All Employees," but then the results float in an unlabeled row below "Total." Any suggestions for how I might only have one label that is aligned correctly? Thank you!

    This is the code I have tried:

    Code:
    collect style header var[Total], level(hide)
    collect style header colname[Total], level(hide)
    collect style header Total, title(hide) level(label)

    Click image for larger version

Name:	Screen Shot 2021-12-05 at 4.42.29 PM.png
Views:	1
Size:	406.8 KB
ID:	1639567

  • #2
    In case anyone else was curious, I found a way to solve my own problem and thought I'd share:
    Code:
    collect recode var `"1.Total"' = `"0"'
    collect label levels var 0 "All Employees", modify

    Comment


    • #3
      Instead of that, you can also write:
      Code:
      collect label levels var 1.Total "All Employees", modify
      Here's an example:
      Code:
      sysuse nlsw88.dta, clear
      collect clear
      gen Total = 1
      table (var) (collgrad), stat(fvfrequency Total race married south) stat(fvpercent Total race married south) nototals
      collect label levels var 1.Total "All Employees", modify
      collect style row stack, nobinder
      collect layout (var) (collgrad#result)

      Comment

      Working...
      X