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

Re: st: Follow Up on LTABLE

From   Maarten buis <>
Subject   Re: st: Follow Up on LTABLE
Date   Thu, 3 Sep 2009 15:38:43 +0000 (GMT)

--- On Thu, 3/9/09, Johannes Schoder wrote:
> I am estimating the lifetables for a
> certain group, e.g. people 
> diagnosed with cancer type i living in county 
> c in year t; This can be done by:
> ltable time_in_months, by (i c t)
> However  Stata tells me:
> "by():  too many variables specified"
> It only works out when I include just one 
> variable in the brackets of the by command.

The trick is to combine these different 
variables into one variable. Here the -egen- 
function -group()- is useful. See the example

*----------- begin example ------------
sysuse cancer, clear

sum age
gen old = age > r(mean)
label define old 1 "old" 0 "young"
label value old old

egen groups = group(drug old) , label

ltable studytime, by(groups)
*----------- end example -------------
( For more on how to use examples I sent to statalist see: )

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen


*   For searches and help try:

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