Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Kaplan Meier by exposure groups

    Hi,

    I am a bit stuck trying to generate a Kaplan Meier curve. I would like to create 4 different Kaplan Meier graphs, comparing 1 variable across 4 different exposure group

    Example:
    Survival of males vs females for using drugA, drugB, drugC and drugD
    I would like to create one graph for each exposure group/drug, each graph comparing survival according to sex.

    Any help is much appreciated

    Thanks

  • #2
    Alexander:
    you may want to try:
    Code:
    sts graph, by(drug sex)
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      I think Carlo's code will give you a single graph with 8 curves (lines) on it.
      if you would "like to create one graph for each exposure group/drug, each graph comparing survival according to sex"
      I am assuming you want to create 4 graphs (one for each drug) comparing survival by sex

      Code:
       sts graph if drug=="A" , by(sex)
      sts graph if drug=="B" , by(sex)
      sts graph if drug=="C" , by(sex)
      sts graph if drug=="D" , by(sex)
      This should give you four graphs provide your variable "drug" is coded as a string variable with values A, B, C and D

      Hope this helps.
      Ashar

      Comment


      • #4
        See post #5 in this threadfor an example of using graph combine to combine multiple graphs into one.
        Last edited by Steve Samuels; 08 Jun 2016, 15:41.
        Steve Samuels
        Statistical Consulting
        [email protected]

        Stata 14.2

        Comment

        Working...
        X