As Nick Cox points out, -egen- can't be combined with pweights. But
-pctile- does accept pweights. Unfortunately, -pctile- is not compatible
with -by-. One possibility would be to hack the code of -pctile- and make
it byable--I haven't looked to see how easy or hard that would be.
Another possibility is to loop on the values of the grouping variable
"type." The resulting medians should be properly estimated. The standard
errors would probably be incorrect because -pctile- will not account for
the stratification and clustering--but based on the wished for model of
-egen median=median(edpct) if salquart==3, by(type)- that is probably not
of concern here.
Hope this helps.
Clyde Schechter
Dept. of Family Medicine & Community Health
Albert Einstein College of Medicine
Bronx, NY, USA
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/