Statalist


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

st: using egen for categorical variable indicating groups


From   Shehzad Ali <[email protected]>
To   [email protected]
Subject   st: using egen for categorical variable indicating groups
Date   08 Jun 2008 04:42:53 +0100

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/




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