[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: table with nested categories
Al Pasaoa asked
> I want to get a one-way table of statistics of a
> variable X, where X is decomposed by nested inequalities, such as:
> Is there a simple command/option for this in Stata?
Nada Wasi suggested
> how about this?
> -construct the new variable,Y, to separate X into
> gen Y = 1 if X>0
> replace Y = 2 if X>5
> replace Y = 3 if X>10
> (you could label Y if you want).
> -then, use the command "table"
> table Y, c(mean Y,...)
I think Nada misses a key point here, that the inequalities
are to be nested, so the variables created would have
to be different.
Alternatively, -tabcount- from SSC will do this for you.
. ssc inst tabcount
. tabcount X, c(>0 >5 >10)
* For searches and help try: