Announcement

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

  • Increase number of characters displayed in value label for svy tab?

    When using svy tab for survey weights, the label cut off is 8 characters, In regular tab, it's something over 20. Additionally, I haven't found any user created macros to increase label length like with the regular stata tab command.

    Code:
    use http://www.stata-press.com/data/r13/nhanes2b
    label define sexl 1 "Male/Man" 2"Female/Woman"
    label values sex sexl
    svyset _n [pweight=finalwgt], strata(stratid) vce(linearized) singleunit(missing)
    svy, subpop(race): tabulate sex, format(%11.3g)
    tabulate sex
    If you run the code you will see that the firs tabulate (using svy) can only print 8 characters of the label, while the regular tabulate command can print out 20+ characters.
    (Also, I know that I could shorten the labels in this example, but I have a data set with many variables and many labels over 8 characters)

    Any ideas how I can get the number of characters displayed in the first column to be longer for svy tabulate?

  • #2
    Well, going to answer my own question here--hopefully it will save other people headaches.
    Use "stubw(20)" as an option to increase the length of the first column with the variable labels.

    Code:
     use http://www.stata-press.com/data/r13/nhanes2b
    label define sexl 1 "Male/Man" 2"Female/Woman"
    label values sex sexl
    svyset _n [pweight=finalwgt], strata(stratid) vce(linearized) singleunit(missing)
    svy, subpop(race): tabulate sex, stubw(20)
    tabulate sex
    Last edited by Daniel Ram; 20 Sep 2019, 11:21.

    Comment

    Working...
    X