Announcement

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

  • Costumize a table with SVY module

    Most of my tables are from survey data. I need to know how to make a table since the "TABLE" command does not work with the "SVY" command. Example of a command in my dofile:

    svy: tab tiempo i.est_socio if e(sample), obs count format(%12.0f)

    I´m using STATA 17

    Thanks. M

  • #2
    Code:
    ssc install estout, replace
    Code:
    webuse nhanes2b, clear
    svyset psuid [pweight=finalwgt], strata(stratid)
    estpost svy: tab race diabetes, obs count format(%12.0f)
    esttab . using myfile.rtf, replace main(b) aux(obs) mlab(none) ///
    noobs not nonotes nonumbers unstack ///
    title("Frequency of diabetes (counts in parentheses)") ///
    eqlab(no yes total, lhs(Race)) nostar label noabbrev
    Res.:

    Code:
    Frequency of diabetes (counts in parentheses)
    -----------------------------------------------------------
    Race                          no           yes        total
    -----------------------------------------------------------
    White                    99682793      3290354    102973147
                               (8659)        (404)       (9063)
    
    Black                    10528681       660555     11189236
                               (1000)         (86)       (1086)
    
    Other                     2908356        60372      2968728
                                (191)          (9)        (200)
    
    Total                   113119830      4011281    117131111
                               (9850)        (499)      (10349)
    -----------------------------------------------------------
    Last edited by Andrew Musau; 01 Mar 2023, 02:46.

    Comment

    Working...
    X