I had a, perhaps, similar problem recently - so here is a program that takes two stset commands to combine two curves one for say overall survival and one for event-free-survival. The idea is to create a bogus dataset so that the two types of survival curve become identified by a variable for 'sts graph,by()' as in the last two lines of the program 'cmbplottask0'. This requires three stset commands.
Is there an easier way to do this?
******{{{ BOGUS combine to single plot EFS and OS curves **********************
capture program drop cmbplottask0
program define cmbplottask0
preserve
tempfile junk1 junk2 junk3 junk4
****prep for first curve***
stset event_d , failure(event_i==1) scale(365.25)
gen byte type=1
outsheet type _t _d using `junk1' if _st,comma
drop type
****prep for second curve***
stset event_d , failure(event_i==1/3) scale(365.25)
gen byte type=2
outsheet type _t _d using `junk2' if _st,comma
drop type
insheet using `junk1',clear
save `junk3',replace
insheet using `junk2',clear
save `junk4',replace
use `junk3',clear
append using `junk4'
rename _t time
rename _d evnt
stset time,failure(evnt==1)
sts graph,by(type) censor(single)
end /*cmbplottask0*/
cmbplottask0
graph save combined01.gph, `replace'
****** BOGUS combine to single plot EFS and OS curves }}}**********************
-Allen
________________________________________
From: [email protected] [[email protected]] On Behalf Of Carlo Lazzaro [[email protected]]
Sent: Wednesday, October 01, 2008 10:48 AM
To: [email protected]
Cc: 'Silvia Lazzarelli'
Subject: R: st: overlapping survival KM graphs
Dear Silvia,
try the following one:
- sts graph, by(variables)- and take a look at - help sts -.
HTH and Kind Regards,
Carlo
-----Messaggio originale-----
Da: [email protected]
[mailto:[email protected]] Per conto di Silvia Lazzarelli
Inviato: mercoled� 1 ottobre 2008 16.11
A: [email protected]
Oggetto: st: overlapping survival KM graphs
I have to compare two Kaplan Meier graphs. I'm able to compare them side
by side. I Kindly ask you the STATA command to overlap them ( into 1 graph
with two different survival curves).
I save the two graphs as .gph files.
I'm using STATA 9.
Thank you
best regards
Silvia Lazzarelli
ARCE
Area di Ricerca Clinica Epidemiologica
Divisione di Medicina e Oncologia Medica
Azienda Ospedaliera Istituti Ospitalieri Cremona
Viale Concordia 1
26100 Cremona
tel. 0372/408035
fax. 0372/408214
email: [email protected]
*
* 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/
*
* 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/
*
* 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/