Hi, Thanks for the help. Could sb expand a little on the egen ... =
cut(age), group(4) command? I'm not sure how to interpret this in "English".
Further, I am also stumped about the first line where it says:
.. keep if _n==_N (so it's saying to keep the current patient observation (2
entries per patient in the Catheter.dta file) as long as it is the same as
the total number of observations in the dataset? - doesn't make sense to me.
Sorry for being really quite elementary. Only just started.\
Thanks again!
Lucy Shum
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Joseph Coveney
Sent: Friday, December 08, 2006 6:31 PM
To: Statalist
Subject: Re: st: specify groups within a group
Lucy Shum wrote:
Hi all, could anybody advise on how to specify in STATA, analysis of
specific groups within a category? That is, if I have a category called
events_mastitis - there are 7 different groups meaning there are animals
that experienced between 1 - 7 episodes of mastitis within a lactation. Say
if I only want STATA to analyze, tabulate, create graphs of.., say Group 1
and 5 only. How do I go about doing that?
Also, using the example above, how do I go about writing a command so that
STATA compares the survival estimates of these 7 groups? Logrank? Is there a
modified procedure that deals with comparison of greater than 2 groups?
----------------------------------------------------------------------------
----
You can use -inlist()- to select groups:
tabulate pathogen if inlist(events_mastitis, 1, 5)
You can use Stata's survival commands for comparing more than two groups.
The example below creates four groups (age categories) and peforms a
log-rank test and Cox regression.
Joseph Coveney
use http://www.stata-press.com/data/r9/catheter, clear
bysort patient (time): keep if _n == _N
egen byte age_category = cut(age), group(4)
stset time, failure(infect)
sts test age_category
xi: stcox i.age_category
exit
*
* 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/