Announcement

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

  • display ALL categories when using estout in descriptive statistics

    Hi everyone,

    I'm working on some descriptives of a categorical variable which I'd like to Export to Excel. I would like to split my results by region. I tab the results by Region and then append them. However, Excel only displays the categories that are present in the first Region (below "Region 1"). Categories which are only present in "Region 2" are listed below and Labels do not appear ("2" and "3" below).
    Is there any way to tell stata to display categories from the beginning even if they are not present in Region 1?

    Here the commands I used:


    *Tab educational Level by Region
    local VARS3 b2
    local TITEL3 "B2. By Region: Educational attainment"
    bysort a11a: eststo: estpost tab `VARS3'
    esttab,
    estout using `FILE', cells("b(label(freq)) pct(fmt(3))") title(`TITEL3') append varlabels(`e(labels)') label
    eststo clear

    Region 1 Region 2
    freq pct freq pct
    -9 1 2.564 1 2.778
    Pas d'école formelle / seulement écoles Coraniques 24 61.538 18 50
    Niveau primaire ou moyen 14 35.897 12 33.333
    Total 39 100 36 100
    2 4 11.111
    3 1 2.778

    Any help is highly appreciated.
    Best,
    Daniela

  • #2
    There is no reproducible example. I suggest that you present

    Code:
    dataex in 1/5

    Comment


    • #3
      You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex.

      As Andrew suggests, we can do much more if we can see the data. I

      Comment

      Working...
      X