Announcement

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

  • sts graph (by group and overall on same graph)

    I'm trying to graph survival curves stratified by group and overall on the same plot. I'm able to create these graphs separately, but is there a way to overlay them?

    sts graph
    sts graph, by(site)

  • #2
    The trick of expanding the data and creating a total category should get you what you want.

    Code:
    use https://www.stata-press.com/data/r17/drug2, clear
    set scheme s1color
    sts graph, hazard saving(gr1, replace)
    expand 2, g(new)
    replace drug=3 if new
    sts graph, by(drug) hazard legend(order(1 "placebo" 2 "drug" 3 "total")) saving(gr2, replace)
    gr combine gr1.gph gr2.gph
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	33.4 KB
ID:	1652423

    Comment


    • #3
      This worked for me -- thank you so much!

      Comment

      Working...
      X