Statalist


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

RE: st: using egen for categorical variable indicating groups


From   "Shehzad Ali" <[email protected]>
To   <[email protected]>
Subject   RE: st: using egen for categorical variable indicating groups
Date   Sun, 8 Jun 2008 15:00:20 +0100

Sorted. Thank you.

Shehzad


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Rufus Peabody
Sent: 08 June 2008 07:35
To: [email protected]
Subject: Re: st: using egen for categorical variable indicating groups

To access your local macro, max, you need to refer to it as `max' .

On Jun 8, 2008, at 12:17 AM, Shehzad Ali wrote:

> Please ignore my previous question. I was using global which was not  
> previously defined because I was following commands from a manual. I  
> have rectified the previous problem but now I am getting a different  
> error. Here is what I do:
>
> qui sum y
> local max=r(max)
> kdensity y [aw=wt], n(100) nograph
> local width=r(scale)
> egen ygroup=cut(y), at(0(width)max) icodes
>
> But I get this error after the last line:
>
> at() invalid -- invalid numlist
>
> I have defined the local 'width'. I am not sure why I am still  
> getting an error. Any help would be appreciated.
>
> Thanks,
>
> Shehzad
>
> On Jun 8 2008, Shehzad Ali wrote:
>
>> Hi,
>>
>> I am trying to generate categorical variable indicating income  
>> groups. My income variable is y. Here is what I am doing:
>>
>> qui sum y
>> local max=r(max)
>> kdensity y [aw=wt], n(100) nograph
>> local width=r(scale)
>> egen ygroup=cut(y), at(0(`width')`max') icodes
>>
>> But I get this error when I run the last line:
>>
>> { required
>>
>> I am not sure where I am missing brackets. I have also tried the  
>> following but it didn't help.
>>
>> egen ygroup=cut(y), {at(0(`width')`max')} icodes
>>
>> Any help would be appreciated.
>>
>> Cheers,
>>
>> Shehzad
>> *
>> *   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/


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index