Announcement

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

  • Kaplan Meier Plot - By group and sex

    Hello
    Is it possible to create a KM plot by group and each group by sex?
    i have tried
    sts graph, by(group) by(sex)
    the second by(sex) has been left out.
    Lars

  • #2
    Lars,

    Try:

    Code:
    sts graph, by(group sex)
    Regards,
    Joe

    Comment


    • #3
      Joe,
      no i cannot seem to get that to work.
      thank you though
      Lars

      Comment


      • #4
        Lars, what does Stata tell you when you try Joe's suggestion; his suggestion should work if both group and sex are numeric variables - are they?

        Comment


        • #5
          As Rich says, what exactly do you mean by "doesnt work". Joe's advice is correct, e.g. try:

          Code:
           webuse drug2
           gen young = age<47
           sts graph, by(drug young)
          Last edited by Steve Samuels; 27 Mar 2015, 15:15.
          Steve Samuels
          Statistical Consulting
          [email protected]

          Stata 14.2

          Comment


          • #6
            You are absolutely correct. Don't know how i messed that up.
            Now for question number two.
            What if i only want to display data for one sex?
            Lars

            Comment


            • #7
              That's where Stata's -if- comes in.

              sts graph if sex==1, by(drug young)

              Comment

              Working...
              X