Statalist


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

Re: st: RE: how can I create deciles by group?


From   "Erasmo Giambona" <e.giambona@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: how can I create deciles by group?
Date   Mon, 16 Jul 2007 12:57:26 -0400

Hi Alexander,
Thanks very much. It was really what I needed.
Regards,
Erasmo

On 7/16/07, Alexander Pütz <puetza@uni-koeln.de> wrote:
Hallo Erasmo,

You can try it by creating a local with all your years and then run the
xtile in combination with the if command. That's the way I did it:

------------
gen size_decile = .

levelsof yearvar, local(tempyear)

foreach i in `tempyear' {
xtile decile_temp=size1 if yearvar==`i', nq(10)
replace size_decile = decile_temp if missing(size_decile)
drop decile_temp
}

--------------

Regards,
Alex











.

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Erasmo Giambona
> Sent: Monday, July 16, 2007 4:25 PM
> To: statalist
> Subject: st: how can I create deciles by group?
>
> Dear Statalist,
>
> I need to create deciles for my dataset by year. I understand STATA
> allows one to get deciles for the full data set (in my case I used:
> xtile size_decile=size1, nq(10)), but I  really need to get my deciles
> by year. I realize that the "by" group does not work with "xtile". Is
> there any way to get the size deciles by year?
>
> I would appreciate any suggestions.
>
> Regards,
> Erasmo
> *
> *   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/

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