Announcement

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

  • Calculating means/median by ignoring zeros allocation

    Hello, ​​forum,
    I want to calculate means/medians budget shares on the choices that consumers made from different choice sets. The attached excel sheet shows budget shares on the choice set one. Consumers were allocated with eight different choices to choose and allocate a share of the given budget on the varieties of their choices. The assumption was that; consumer must allocate the given budget on the choices he made. The varieties allocated zeros across eight choices show the given varieties was not chosen. Now, I want to ignore the zeros allocations and consider only non-zeros allocations to calculate the means/median budget share on each variety. Which command is suitable for this analysis?
    Thanks.
    Attached Files

  • #2
    Ezekiel:
    please read the FAQ on how to post (or not) attachmenst.
    Please note that most on this list do not download spreadsheets from unknown sources/senders, due to the risk of active contents.
    That said, you may want to consider an -if- condition, such as:
    Code:
    tabstat <yourvariable> if <yourvariable> !=0, stat(count mean sd p50 min max)
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Carlo,
      Thank you very much for the reminder. The code had become so useful/helpful. Thank you in advance.

      Comment

      Working...
      X