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.