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   08 Jun 2008 05:17:46 +0100

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/



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