Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: RE: converting continuous var to ordinal with equal obs numbers per group


From   Nikolaos Pandis <[email protected]>
To   [email protected]
Subject   Re: st: RE: RE: converting continuous var to ordinal with equal obs numbers per group
Date   Sat, 28 Nov 2009 07:17:35 -0800 (PST)

Dear Martin and Maarten,

Many thanks for the help.

Best wishes,
Nikolaos

--- On Sat, 11/28/09, Martin Weiss <[email protected]> wrote:

> From: Martin Weiss <[email protected]>
> Subject: st: RE: RE: converting continuous var to ordinal with equal obs numbers per group
> To: [email protected]
> Date: Saturday, November 28, 2009, 2:04 PM
> 
> <>
> 
> If the equal frequency is really important to you:
> 
> 
> 
> *******
> clear*
> set obs 1500
> 
> local a 15
> local b 86
> gen age=`a'+int((`b'-`a'+1)*runiform())
> 
> sort age
> gen byte group=sum(mod(_n,100)==1)
> 
> table group, contents(freq min age max age )
> graph dot (mean) age (min) age (max) age, over(group)
> *******
> 
> 
> HTH
> Martin
> 
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]
> On Behalf Of Martin Weiss
> Sent: Samstag, 28. November 2009 12:45
> To: [email protected]
> Subject: st: RE: converting continuous var to ordinal with
> equal obs numbers
> per group
> 
> 
> <>
> 
> " ...with equal number of observations per group"
> 
> 
> With integer cutpoints, the equal frequency part of your
> request is hard to
> comply with:
> 
> 
> *******
> clear*
> set obs 1500
> 
> local a 15
> local b 86
> gen age=`a'+int((`b'-`a'+1)*runiform())
> 
> egen catage = cut(age), /* 
>  */  group(15) label
> 
> table catage, /* 
>  */  c(freq min age max age)
> *******
> 
> 
> HTH
> Martin
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]
> On Behalf Of Nikolaos Pandis
> Sent: Samstag, 28. November 2009 11:48
> To: [email protected]
> Subject: st: converting continuous var to ordinal with
> equal obs numbers per
> group
> 
> Hi to all,
> 
> I  a continuous variable (age) with a range from 15-86
> and around 1500
> observations.
> How could I convert it into an ordinal variable with equal
> number of
> observations per group, given that I would like to have
> around 15 groups.
> 
> Many thanks,
> 
> Nikolaos
> 
> 
>       
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 


      

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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