Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: xtile


From   Philipp Rehm <philipp.rehm@gmx.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: xtile
Date   Mon, 07 May 2007 11:22:23 +0200

You may want to look at the user-written -egenmore- collection (type: "ssc install egenmore").
In particular, check out the -xtile- command with egenmore. Syntax would be something like:
egen mpg4 = xtile(mpg), by(foreign) p(25(25)75)

HTH,
Philipp


Erik Bihagen wrote:

Hello STATA users,

I am trying to transform a variable v1 to values representing the percentiles. This can be done by the xtile command in STATA.
However, I do not succeed in doing this separately for categories defined by another variable v2.
It looked like xtile2 was the solution but it does not seem to work in STATA 9.

With SPSS the following command would do the job and automatically create the variable pv1.

rank variables= v1 (a) by v2 /proportion /print=yes
/ties=mean
/fraction=blom .

However, I would prefer using STATA instead of switching between STATA and SPSS.

I would very much appreciate help with this.

Erik Bihagen

*
* 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/

*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index