using svy command and computing median


Hi Joe,

I am looking to compute median income for different racial groups from the ACS, while using svy. Stata doesn’t seem to allow me to do:

svy: bysort race: sum inctot, de


bysort race: sum inctot [pweight=perwt], de

How do you recommend I get medians while using the svy command? Thanks!

Ps- my apologies for contacting you directly, but I am getting pretty anxious.


findit epctile

* should lead to my webpage

epctile inctot, svy percentile(50) over(race)

HTH, Stas


Thanks for the epctile tip. I used it, and I got:

Mata run-time error


Is there a bug?


There is no Mata code in epctile.ado, so this must be some sort of version incompatibility. Can you post the full output?



epctile inctot, svy percentile(50) over(asian1g)

(running mean on estimation sample)

Mata run-time error


Thanks again


OK, didn’t help :-\

set trace on

set tracedepth 2

which epctile

epctile again

Send to the address in the header of the epctile.ado file which would show up when you “which” it.



When I “Which” it, I get:

*! percentile as estimation procedure

Where shall I send it exactly?


Also, it seems to think that “again” is a variable, it says,

variable again not found.


Hm. This is probably a REALLY old version of the file, then.

skolenik at gmail dut com


I have been able to update the .ado file on my website, so try

net from…

net d epctile

net install epctile, replace

It should show something like

. which epctile
*! percentile as estimation procedure v.1.4 by Stas Kolenikov, skolenik at gmail dot com

If it still does not work, I’ll ask for more detailed debug info.