Announcement

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

  • Calculate median with conditions

    I want to calculate the median of a variable with certain restrictions. I know that -sum variable, detail- gives me the 50th percentile, ie the median. Also I can command -sum variable if condition- but that doesn't give me the median. Also I'm not allowed to command -sum variable, detail if condition- or variations of that. Concretely I want something like -sum income, detail if income>1000-
    Probably a simple answer, but any help would be appreciated.

  • #2
    Code:
    sum income if income > 1000, detail
    The help for summarize gives an example

    Code:
    summarize mpg weight if foreign, detail
    showing that the
    if
    condition belongs with the variable list, not with the options.

    Comment

    Working...
    X