Statalist


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

Re: st: Follow Up on LTABLE


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
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
below:

*----------- 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:
http://www.maartenbuis.nl/stata/exampleFAQ.html )

Hope this helps,
Maarten

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

http://www.maartenbuis.nl
--------------------------


      

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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